ThemeForest

Best way to make alternate home pages

1914 posts Do the Needful
  • Envato Staff
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Support Staff
  • United States
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Beta Tester
  • Interviewed on the Envato Notes blog
+7 more
JamiGibbs support says

Hey everyone! I’m having a hard time deciding what the best way would be to create alternate home page choices for the user in a Wordpress theme. I understand that some themes use home.php but I thought there would be a tutorial or something online I could reference to link home page layout choices into my theme’s options panel. Strangely, I’m coming up with nothing.

Does anyone have a resource for this?

264 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
  • United Kingdom
Shellbot says

Stick a select box in the options page, create a template for each preset layout, check in home.php/index.php for the value of the relevant theme option and include the needed template?

1914 posts Do the Needful
  • Envato Staff
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Support Staff
  • United States
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Beta Tester
  • Interviewed on the Envato Notes blog
+7 more
JamiGibbs support says
Stick a select box in the options page, create a template for each preset layout, check in home.php/index.php for the value of the relevant theme option and include the needed template?

Maybe I’ve been over thinking it. Thanks, Michelle. I’ll see if that will work ok.

1914 posts Do the Needful
  • Envato Staff
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Support Staff
  • United States
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Beta Tester
  • Interviewed on the Envato Notes blog
+7 more
JamiGibbs support says

So simple I have no idea why I was making it harder for myself. My final solution added to index.php:

<?php get_header(); ?>

<?php if (get_option('pt_home_layout') == 'Home Main') { include(TEMPLATEPATH . '/includes/home-main.php'); } ?>

<?php if (get_option('pt_home_layout') == 'Home Alternate') { ?>
    <?php include(TEMPLATEPATH . '/includes/home-alternate.php'); ?>
<?php } else { include(TEMPLATEPATH . '/includes/home.php'); } ?>

<?php get_footer(); ?>

Now I’m asking myself why many of the themes sold here (at least the ones I’ve seen) don’t come with the simple extra step of creating alternate home page layouts.

264 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
  • United Kingdom
Shellbot says

I think a lot have options that change the layout of the homepage (turning certain elements on and off) rather than having actual preset layouts to switch between. I’m sure plenty do it this way too though, maybe one day when I can afford to buy some I’ll find out :p

2932 posts
  • Community Superstar
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
  • United States
  • Exclusive Author
chrisakelley says
I think a lot have options that change the layout of the homepage (turning certain elements on and off) rather than having actual preset layouts to switch between. I’m sure plenty do it this way too though, maybe one day when I can afford to buy some I’ll find out :p

yes something like

<?php get_header(); ?>

        <div class="colum-1">

            <?php include(TEMPLATEPATH . '/includes/slider.php'); ?>

            <?php $layout = get_option('obm_layout');

                include('layouts/'.$layout);

            ?>

        </div><!--/colum-1-->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

you can just use the option on the admin side to control as many layouts as you want the sliders just there from a project its un-needed

2932 posts
  • Community Superstar
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
  • United States
  • Exclusive Author
chrisakelley says
I think a lot have options that change the layout of the homepage (turning certain elements on and off) rather than having actual preset layouts to switch between. I’m sure plenty do it this way too though, maybe one day when I can afford to buy some I’ll find out :p

yes something like

&lt;?php get_header(); ?&gt;

        
<?php include(TEMPLATEPATH . ’/includes/slider.php’); ?> <?php $layout = get_option(‘obm_layout’); include(‘layouts/’.$layout); ?> <!-/colum-1->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

you can just use the option on the admin side to control as many layouts as you want the sliders just there from a project its un-needed

I should include the layout path is defined in the admin panel to like this

$layout_path = TEMPLATEPATH . '/layouts/'; 
205 posts
  • Bought between 100 and 499 items
  • United Kingdom
  • Has been a member for 4-5 years
  • Exclusive Author
  • Referred between 1 and 9 users
naweedshams says
So simple I have no idea why I was making it harder for myself. My final solution added to index.php:
<?php get_header(); ?>

<?php if (get_option('pt_home_layout') == 'Home Main') { include(TEMPLATEPATH . '/includes/home-main.php'); } ?>

<?php if (get_option('pt_home_layout') == 'Home Alternate') { ?>
    <?php include(TEMPLATEPATH . '/includes/home-alternate.php'); ?>
<?php } else { include(TEMPLATEPATH . '/includes/home.php'); } ?>

<?php get_footer(); ?>
Now I’m asking myself why many of the themes sold here (at least the ones I’ve seen) don’t come with the simple extra step of creating alternate home page layouts.

Strongly agree with you on that. I bought a theme the other day.. from elsewhere.. and only just discovered it comes with 15 homepage layouts and 30 page templates.. sweet :D

Wish the same format would be available on TF.

by
by
by
by
by