WordPress.org

Ready to get started?Download WordPress

Forums

How to make different pages show different widgets. (6 posts)

  1. freeworldmarketing
    Member
    Posted 5 years ago #

    I am creating a website with static pages and I would like to somehow customize the widgets differently for different sections of the website. I would like to create pages that will have different links in the sidebars than the rest of the website.

    From the main website there will be a link to the main page for that section. Then that page will have links to all of it's child pages. But I only want those links to show up on that page and it's child pages but not on the rest of the website.

    Is there a way to do this? Preferably a way without writing code.

  2. ginntonic
    Member
    Posted 5 years ago #

    Well, you'll have to do SOME code writing:

    I imagine your widgets are in your sidebar, or some other file; setup collections of those widgets and write 2, 3, 4, etc. separate files for those collections.

    Where you want them to appear, use the php tag
    <?php include ('widgets_collection1.php'); ?> where "widegets_collection1.php" is the file names you named those collections.

    This is the least code-intensive way; not the cleanest, but the least code-intensive way.

    Your other option is to include the widgets in if(is()) statements:
    E.g.

    <?php if ( is_page('N') ) { ?>
    
    -------------
    Code for your widgets
    -------------
    } ?>

    where N in the is_page() is the page id in the CMS.

    I recommend the include() option.

    Cheers.

  3. Justin Tadlock
    Member
    Posted 5 years ago #

    Let's not overly complicate things here. You don't have to write ANY code to do this.

    Here are a couple of plugins that allow you to dynamically show widgets:
    http://wordpress.org/extend/plugins/widget-logic
    http://konstruktors.com/blog/wordpress/842-wordpress-gpl-widget-context-plugin

    Then, if you need better widgets, try out the Widgets Reloaded plugin, which will give a lot more widget settings:
    http://wordpress.org/extend/plugins/widgets-reloaded

    OK. Maybe I lied just a little about not having to use any code. If you use the Widget Logic plugin, you'll have to use conditional tags, but I would hardly call this coding. No coding is required with Widget Context though.

  4. freeworldmarketing
    Member
    Posted 5 years ago #

    Thanks for that. The plugin might be what I need. There is another option that might work that I saw on Youtube that might be even more simple but I don't know how to make it work. The guy was showing that on his "pages" widget a main page would show up on the list and so would it's child and the childs child. But any more subpages wouldn't be on the list. But on my list it doesn't do that it will show sub pages many levels deep. Is there a way to change the settings so it will only show a child or 2 deep?

  5. theobroma
    Member
    Posted 5 years ago #

    I use a plugin called "Slayer's Custom Widgets".

    It does what you describe.

  6. eelaff
    Member
    Posted 4 years ago #

    thanks a lot. great help

Topic Closed

This topic has been closed to new replies.

About this Topic