**How to make widgets appear on certain pages or posts - The Widget Ninja

Widget Ninja’s GUI can be found on the bottom of every widget’s GUI. Options look the same for every widget. Please don’t forget to click “Save” after making changes to widget’s settings.

Main settings

Main settings are used to determine logical operator Ninja uses for that widget, or to completely disable Ninja (for that widget).

  • if Widget Ninja is disabled the widget will be shown on all pages
  • logical “or” operator will show the widget if any conditional tag returns true
  • logical “and” operator will show the widget only if all conditional tags return true
  • last option, logical “not” displays the widget only if all conditional tags return false

Creating logical statements with conditional tags

You can use 22 tags (8 can have additional parameters configured) to create logical statements. Only tags in the “active conditional tags” box are part of the statement. Ones in the box below are disabled. Tags order is irrelevant and does not affect the end result of conditional testing. Each tag returns only return true (1) or false (0) values. Additional tag parameters are configured by clicking the “Options” icon on the tag.
Detailed in-line help is available for every tag by clicking its “Help” icon.

is_home
Additional options available: no.
Checks if the main page is being displayed. If you select a static page as your front page then use is_front_page.
See is_home description on WordPress Codex.

is_front_page
Additional options available: no.
Checks if the main page is a post or a page. It returns true when the main blog page is being displayed and the Settings-Reading-Front page displays is set to “Your latest posts”, or when is set to “A static page” and the “Front Page” value is the current page being displayed.
See is_front_page description on WordPress Codex.

is_category
Additional options available: yes.
Checks if a category archive page is being displayed. If you define specific category (or categories using options icon) it will check only for that category.
Should not be confused with in_category.
See is_category description on WordPress Codex.

in_category
Additional options available: yes.
Checks if the current post is assigned to any of the specified categories (use options icon to select categories).
Tag considers only the categories a post is directly assigned to, not the parents of the assigned categories.
See in_category description on WordPress Codex.

is_tag
Additional options available: yes.
Checks if a tag archive page is being displayed. Use options icon to select specific tags you want to check for.
Should not be confused with has_tag.
See is_tag description on WordPress Codex.

has_tag
Additional options available: yes.
Check if the current post has any of the given tags (use options icon to choose tags). If no tags are given, determines if post has any tags.
See has_tag description on WordPress Codex.

is_tax
Additional options available: yes.
Checks if a custom taxonomy archive page is being displayed. You should use is_category() and is_tag() respectively when checking for category and tag archives.
See is_tax description on WordPress Codex.

is_404
Additional options available: no.
Checks if a 404 error page is being displayed.
See is_404 description on WordPress Codex.

is_page
Additional options available: yes.
Checks if a page is being displayed (use options icon to choose which pages you want to test for). If no pages are defined it determines if any page is displayed.
See is_single if you want to test if a single post is being displayed.
See is_page description on WordPress Codex.

is_single
Additional options available: yes.
Checks if a single post is being displayed (use options icon to choose which posts you want to test for). If no posts are defined it determines if any post is displayed.
See is_page if you want to test if a single page is being displayed.
See is_single description on WordPress Codex.

is_sticky
Additional options available: no.
Checks if “Stick this post to the front page” check box has been checked for the current post.
Click options icon if you want to test “stickiness” for posts other than current.
See is_sticky description on WordPress Codex.

is_search
Additional options available: no.
Checks if search result page archive is being displayed.
See is_search description on WordPress Codex.

is_archive
Additional options available: no.
Checks if any type of archive page is being displayed. An archive is a category, tag, author or a date based page.
See is_archive description on WordPress Codex.

is_post_type_archive
Additional options available: yes.
Checks if a post type archive page is being displayed. Use options icon to define which post type should the tag check for.
See is_post_type_archive description on WordPress Codex.

is_preview
Additional options available: no.
Checks if current page/post is in preview mode (not yet published).
See is_preview description on WordPress Codex.

is_paged
Additional options available: no.
Checks if page being displayed is “paged”.
This refers to an archive or the main page being split up over several pages. It does not refer to a post or page whose content has been divided into pages using the <!–nextpage–> QuickTag.
See is_paged description on WordPress Codex.

is_attachment
Additional options available: no.
Checks if an attachment is being displayed. An attachment is an image or other file uploaded through the post editor’s upload utility. Attachments can be displayed on their own “page” or template.
See is_attachment description on WordPress Codex.

is_singular
Additional options available: no.
Checks if a singular page is being displayed. Singular page is when any of the following conditional tags return true: is_single, is_page or is_attachment.
Use options icon to define specific post types the tag should check for.
See is_singular description on WordPress Codex.

comments_open
Additional options available: no.
Checks if comments are allowed on the current post/page.
See comments_open description on WordPress Codex.

has_excerpt
Additional options available: no.
Checks if the current post has an excerpt.
See has_excerpt description on WordPress Codex.

is_user_logged_in
Additional options available: no.
Checks if the current visitor is logged in.
See is_user_logged_in description on WordPress Codex.

is_user_guest
Additional options available: no.
Checks if the current visitor is a guest (not logged in).

is_author
Additional options available: yes.
Checks if an author archive page is being displayed. Use options icon to check for a specific author’s archive.
See is_author description on WordPress Codex.

is_user_admin
Additional options available: no.
Checks if the current visitor is logged in and has administrator privileges (manage_options capability).

is_user_role
Additional options available: yes.
Checks if the current user has one of selected user roles. Custom roles are supported. Use options icon to select roles.
See current_user_can description on WordPress Codex.

Debugging

If you’re having problems writing complex conditional statements or a widget is (not)visible where it should be you can easily find out what’s going on with the debug feature.

Login and configure widget’s settings. Open the problematic page with “wn-debug” GET parameter. Ie: www.myblog.com/?wn-debug. On the very bottom of the page you’ll see a box with debug info for every widget and every conditional statement that was run to determine its visibility. Please note that you have to be logged in to see debug info.

Feedback and Knowledge Base