- Envato Staff
- 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
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?
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?
- Envato Staff
- 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
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.
- Envato Staff
- 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
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.
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 
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![]()
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
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![]()
yes something like
<?php get_header(); ?><?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/';
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 
Wish the same format would be available on TF.
