So this is not actually a tutorial, but a tip to add some logic to the widgets that are used on your WordPress blog. The functions of this plugin uses the WordPress conditional tags.
To make this post pretty helpful I have added some common tags that hides or shows widgets and here we go.
is_single() to display the widget only on single pages
is_home() to display the widget only on home page
is_single(12) to display the widget on the post ID 12. The post ID is nothing but a unique number that was allocated to a blog post. So how to find the post? Simple one of my fellow blogger have blogged about it, just head over there.
!is_home() to display the widget on all the places except the homepage.
strpos($_SERVER['HTTP_REFERER'], “google.com”)!=false to display the widget for visitors who comes through Google. You can try the same step to replace Google.com with Facebook.com if you want to have a greet message for Facebook users.
is_single(‘Blogger Tips’) to display the widget on the post titled Blogger Tips. This indirectly helps you in adding a suitable affiliates ads for certain pages.
is_page(‘contact’) to display the widget only on a particular page contact. You can change the value “contact” to any page name of your wish.
is_category(array(5,9,10,11)) to display the widget only for certain category classified by category numbers*. You can even use single category numbers to hide or show widgets.
is_user_logged_in() to display the widget only for logged in users.
*To know category numbers in WordPress head to the category page in
your Wp admin and click on edit on any of the one category. Look into
your address bar to find the category ID.is_single(12) to display the widget on the post ID 12. The post ID is nothing but a unique number that was allocated to a blog post. So how to find the post? Simple one of my fellow blogger have blogged about it, just head over there.
!is_home() to display the widget on all the places except the homepage.
strpos($_SERVER['HTTP_REFERER'], “google.com”)!=false to display the widget for visitors who comes through Google. You can try the same step to replace Google.com with Facebook.com if you want to have a greet message for Facebook users.
is_single(‘Blogger Tips’) to display the widget on the post titled Blogger Tips. This indirectly helps you in adding a suitable affiliates ads for certain pages.
is_page(‘contact’) to display the widget only on a particular page contact. You can change the value “contact” to any page name of your wish.
is_category(array(5,9,10,11)) to display the widget only for certain category classified by category numbers*. You can even use single category numbers to hide or show widgets.