1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs 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?

284 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+3 more
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?

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs 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.

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs 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.

284 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+3 more
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

3437 posts
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in United States
  • Has been part of the Envato Community for over 4 years
+1 more
organicbee 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

3437 posts
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in United States
  • Has been part of the Envato Community for over 4 years
+1 more
organicbee 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/'; 
206 posts
  • Has been part of the Envato Community for over 5 years
  • Has collected 100+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in United Kingdom
+1 more
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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by