Changing Content In A Widget

  • penpoint

    #4282

    I’m looking for a way to display different content in a widget for different pages. In other words, I want to take the “graphene_before_footer” widget and have the information vary according to what page it is on. I want the widget to display on all pages and posts, only with information relevant to that particular page.

    Can anyone offer a solution or point me towards a tutorial? I’ve tried Widget Logic, but it seems to only allow me to control which pages a widget shows up on.

    Thanks for any help or suggestions.

    Bill

    Mod

    Kenneth John Odle

    #27795

    There are two ways you can handle this:

    1) Create a separate widget for each page/post and use the Widget Logic to make that particular widget only show up on that page/post.

    2) Create a single widget, but use the WP PHP Widget plugin to use PHP widgets, rather than text widgets. Then you could use a bunch of if...then statements in each widget to control what it displays.

    Frankly, the former method is probably the easiest. If you have more than the merest handful of pages, the code in the second method could become quite cumbersome.

    penpoint

    #27796

    Thanks for that.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.