[wp-hackers] Pagination: How to display sidebar content on front page only?

Tiago Relvao trelvao at workmedia.pt
Wed Jan 13 10:22:09 UTC 2010


Just a reminder... Don't forget there is a template file - home.php. You 
can use it to further customize your home page.

If you want to change more than a sidebar it's best not to use 
conditional tags as things may get confuse and difficult to maintain. 
You can copy your template index.php and call it home.php as a base for 
your development.

Best regards, Tiago


Peter Westwood wrote:
>
> On 12 Jan 2010, at 22:36, RePost wrote:
>>
>> Thanks, all. I used your suggestions, and this is what worked for me:
>>
>> <?php
>> if ( is_front_page() && !is_paged() )
>> include("sidebar-index.php");
>> else
>> include("sidebar.php");
>> ?>
>>
>
> An improvement on this which makes it much more friendly if you 
> include in a released theme (and enabled child theme overload of 
> template files) is to use get_sidebar();
>
> <?php
> if ( is_front_page() && !is_paged() )
>     get_sidebar('index');
> else
>     get_sidebar();
> ?>
>
> This allows for named sidebars as shown about and will also search 
> child theme first and fallback to default theme sidebar.php if no file 
> is found to include.
>
> Cheers
>
> Peter

-- 
TI Workmedia (webdevelopment)
e-mail: ti at workmedia.pt
Tel. +351 210 410 394



More information about the wp-hackers mailing list