• Blog

    Latest from our Blog

  • Tools

    Our Favourite WP Tools

  • Hosting

    Recommended Web Hosts

  • Coupons

    Get great money off deals

  • Themes

    WordPress Theme Directory

  • Plugins

    WordPress Plugins Directory

  • Promote

    Your WordPress Product

With the addition of custom menus in WordPress, it has become much easier to define your own menus. However, it still does not give the ability to make entirely custom sidebars. There are some of you out there who would prefer to have complete control over all of your sidebars and where specific widgets will be shown.The Widget Logic plugin essentially gives every widget a new field where you can specify where it should appear. You may want to have a custom sidebar on every single page on your WordPress blog, and Widget Logic is just the right tool to achieve this.

Install Widget Logic

The plugin is available to download on the WordPress plugins directory. You could also install the plugin from your WordPress website. There is virtually nothing to configure at all. You just install and activate and you are ready to go.

Using Widget Logic

Widget Logic may seem a little confusing at first, however you just need to get yourself acquainted with WordPress’ conditional tags. They are essentially quite simple to understand.

Let’s say you have three pages: Home, About and Contact. If you would like a widget to simply appear on the homepage only, you would need to visit the widget configuration page on your WordPress website and open the widget to display it’s settings. A logic field will now viewable and you will be able to enter a conditional tag to choose where to display this widget. To display this widget purely on the homepage, you would enter the following:

is_home()

As you can see, it is fairly simple to define where your specific widgets will be shown. However, if you would like to display this widget on a page other than the homepage, you would need to know the Page ID of that particular page. To find the out a Page ID, go to your page list on your WordPress blog and hover over a page. You will be shown the links destination and at the end of the link, you can see the ID of that specific page.

Once you have acquired the specific Page ID’s that you need, you will need to implement them in to the following code:

is_page('1,3,5')

I have used the Page ID’s one, three and five for this example. The above code means that only those three pages will be shown on that pages relative sidebar.

Advanced Logic

There are several other tags that can be used within the logic field that can be classed as somewhat advanced, such as:

This tag will make this widget only viewable to administrators only :

current_user_can('level_10')

This widget is only viewable to those who have reached the page through a google search :

strpos($_SERVER['HTTP_REFERER'], "google.com")!=false

This widget will appear for posts tagged with “featured” :

has_tag (‘featured’)

For all posts in the “WordPress” category :

is_category(‘wordpress’)

You can find more advanced widget codes on the plugin author’s website. I hope you found this guide useful, tell us if you find this plugin useful!


Author:

Hi, I'm Smair Habib. I am a freelance blogger and writer. I have been a consistent wordpress user for well over four years.

Leave Yours +

5 Comments

  1. Steve

    Thanks Shamir, I am using the “1.has_tag (‘featured’)” and substituted a zip code # between the (‘ ‘) which will display a local Tennessee USA Banner in the second row when you search zip 37307. Shamir were are you located; do you ever search for American made products? You can leave me a message on the Refer / Comment page. http://www.b4usa.com/

  2. Michel

    This is a great tool, but do you know why it’s not working with the Gantry Framework?

  3. Anonymous

    Hi! Very helpful. Thanks for posting! 

    One thing worth noting is that,
    is_page(‘1,3,5′) 
    didn’t work for me. The widget would appear on page 1, but not on 3 or 5

    Instead I used: 
    is_page(array(1,3,5))

  4. cost, but also wanted to know if it works with the Gantry Framework …

  • Comments are Closed

Search

Our Sponsors