[ALL THEMES] How to use Widget Logic plugin?

Widget Logic is a simple plugin could help you to decide the specific pages to show a widget by using WP’s Conditional Tags, or any general PHP code.

Instead of creating many sidebars, you can drag all widgets you need into a sidebar and give them a condition in Widget Logic field to show in specific pages.

WRITING LOGIC CODE

The text in the ‘Widget logic’ should return ‘true’ when you need the widget to appear.

 

EXAMPLES

  • is_home() — Widget will be appear if the current page is your website homepage.
  • is_page('about-me') — Widget will be appear when the current page’s slug is “about-me”.
  • !is_page('about-me') —Widget will be appear when the current page’s slug is not “about-me” (! (NOT) to reverse the logic).
  • !is_user_logged_in() — Widget will be appear when a user is not logged in.
  • is_category(array(5,9,10,11)) — Widget will be appear when the current page’s category is one of the given category IDs.
  • is_single() && in_category('baked-goods') — Widget will be appear when the current page is single post that’s in the category with this slug
  • get_post_format(get_the_ID()) == 'video' — Widget will be appear when the current page’s format is Video

You can read more in here about using Widget Logic plugin