Support » Fixing WordPress » Select widgets by page

  • How about building in the ability to specify the widgets you want to display on each page of your site from the dashboard? For example, I could see it being handy to display all widgets on the blog’s front page and only a few of them on all the others. It would be very useful for the likes of and any other multi-site instances of WordPress that there may be where users cannot have access to theme code or upload themes of their own choosing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Here’s an idea I’ve used before –

    With a little JavaScript you could toggle visibility by using comment tags in the page content.

    You could use a comment tag like this in your page content –
    <!-- !widget-1 -->

    Then use js to toggle the visibility of widget-1 –

    p = $(this).html().split('!widget-1');

    You can create any number of tags which would toggle specific widgets.

    Perhaps one benefit to this method is that search engines would still index the widget content even if it’s not visible.

    Just be sure you’re not reading the tags from page visitor-submitted comments. 🙂

    I made a jQuery plugin to do something like this. Except you can use any HTML tag’s rel attribute to hold a list of object id’s or class names, like this –

    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="jquery.jlvisi.js"></script>
    <script type="text/javascript">
    	jQuery(document).ready(function () {

    Post or page content:
    <span id="visibility" rel="!.widget-1,!.widget-2,*.widget-3"></span>
    In this example, the span tag could be added to the post or page to control the visibility of the widgets listed in the rel attribute. The ! exclamation mark preceding a class name indicates the object will be hidden. The * asterisk preceding a class name indicates the object will be visible.

    You can get the plugin at my website

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Select widgets by page’ is closed to new replies.