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

Dion Hulse (dd32) wordpress at dd32.id.au
Tue Jan 12 08:52:35 UTC 2010


2 options.

1. Check from within your widget and only output if the right conditions  
are hit

Sounds like you want if ( is_front_page() && !is_paged() )

2. Register 2 sidebars, and call dynamic_sidebar() based on the  
conditionals.

ie.
if ( is_front_page() && !is_paged() )
   dynamic_sidebar('front-page')
else
   dynamic_sidebar('all-others')

that requires you register both sidebars with id=front-page or  
id=all-others. You' then add the widgets to the sidebar that you want them  
on.

On Tue, 12 Jan 2010 19:50:05 +1100, RePost <repost_08 at yahoo.com> wrote:

> Austin Matzko wrote:
>> On Mon, Jan 11, 2010 at 9:07 PM, RePost <repost_08 at yahoo.com> wrote:
>>
>>> I need to place sidebar content on my blog that appears on the home  
>>> page
>>> only.
>>>
>>> This means the content should display only at mysite.com and not at
>>> mysite.com/page/2/
>>>
>>> However, both the home page and inside pages use the same template,
>>> index.php, which means they both use the same sidebar.
>>>
>>> Is there a conditional script that would allow me to use a different  
>>> sidebar
>>> on inside pages?
>>>
>>
>> You can check the returned value of is_home() (or possibly
>> is_front_page() depending on your situation). See
>> <http://codex.wordpress.org/Conditional_Tags>
>>
>
>
> I've certainly looked at the tags is_home, is_page and is_front_page. I
> just don't know what values could possibly create the outcome I'm
> looking for.
>
> For instance, does any value even exist that would address
> mysite.com/page/2, which the Codex refers to only once, as a "generic  
> page"?
>
> I don't know. I'm hoping someone with a deeper knowledge of WordPress
> would have that insight.
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
Dion Hulse / dd32

Contact:
  e: contact at dd32.id.au
  msn: msn at d32.id.au
  skype: theonly_dd32
  Web: http://dd32.id.au/


More information about the wp-hackers mailing list