WordPress.org

Ready to get started?Download WordPress

Forums

Using Widget Logic to display certain widgets on specific pages (5 posts)

  1. mariacharmer
    Member
    Posted 3 years ago #

    I'm very confused about what code to use to have different widgets display on specific pages. Example:
    On the About and Blog page I want the same two arbitrary text widgets and the categories widget to display but I want to omit the Meta and Blogroll widgets to NOT display on the About page.

    How do I achieve this using the Widget Logic plugin?

    Specifically looking for the code for the conditional tag because I am no expert at php yet...much obliged.

  2. alanft
    Member
    Posted 3 years ago #

    Have you had a quick look at http://wordpress.org/extend/plugins/widget-logic/other_notes/ ?

    One of the first example is

    !is_page('about') -- everywhere EXCEPT this specific WP 'page'

    the blog page depends on how you have your blog set up. on the WL faq at http://wordpress.org/extend/plugins/widget-logic/faq/ it says

    "Another source of confusion is the difference between the Main Page and the front page."

    linking to http://codex.wordpress.org/Conditional_Tags#The_Main_Page

  3. mariacharmer
    Member
    Posted 3 years ago #

    Yes, I saw this:
    !is_page('about') -- everywhere EXCEPT this specific WP 'page'

    I figured it out. Actually using the !is-home tag worked!
    Yay.

  4. mariacharmer
    Member
    Posted 3 years ago #

    Actually, I am still have an issue with widgets I want to appear only in the 'about' page sidebar and not on the main blog page. I figure out how to get widgets I want to appear only on the main blog page (login, categories, links) but how do I get the reverse affect?

    I tried this code: !is_page('blog')
    Because I want it 'everywhere' (about page) EXCEPT the BLOG PAGE.
    It didn't work....

  5. The_liz
    Member
    Posted 3 years ago #

    Yes! My project: Display a Category listing on the blog pages but not the static pages, & not the static Home (front) page.
    Add category widget, and put in Widget Logic code space: "is_home() || is_category()" Voila!
    The trick is the blog posts page is considered "home" in WordPress. Example here.

Topic Closed

This topic has been closed to new replies.

About this Topic