Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   Widgets on Pages (or not) (http://forum.bytesforall.com/showthread.php?t=258)

Steve_T Feb 7, 2009 04:38 AM

Widgets on Pages (or not)
I'm adding widgets to my blog but they are not so relevent on the pages. Is it possible to have them not appear on pages or even have some and not others appear on pages

Flynn Feb 7, 2009 05:07 AM

This plugin might do that http://wordpress.org/extend/plugins/widget-logic/

AFAIK you'll insert PHP code into that plugin.

"If this is a page":
PHP Code:


"If this is not a page":
PHP Code:


"If this is a page with the ID V, W, X, Y OR Z"
PHP Code:

in_array$post->ID, array(VWXYZ) ) 

"If this is not a page with the ID V, W, X, Y OR Z"
PHP Code:

!in_array$post->ID, array(VWXYZ) ) 

If $post->ID doesn't work in the examples above try $wp_query->get_queried_object_id()

"If this is the page 'about' or the page 'products'"
PHP Code:

is_page('about') OR is_page('products'

"If this is the homepage" (includes page 2, page 3...):
PHP Code:


"If this is the real homepage" (and not page 2, 3..)
PHP Code:

is_home() AND !is_paged() 

"If this the static page that I selected as homepage"
PHP Code:


Steve_T Feb 7, 2009 05:37 AM

amazing - it works

thanks for all the effort and listing the tags too

gesman Feb 10, 2009 08:13 AM

Few more functions usable for this widget:



All times are GMT -6. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.