• Resolved bobbeers

    (@bobbeers)


    I am afraid the answer to my question will be to abandon the great ease-of-use built into the drag-and-drop dynamic sidebar and widget functionality.

    Since my five most recent posts already populate my homepage, I want to suppress the recent posts widget unless the current page is not is_home().

    I’ve tried a bunch of stuff… the most recent (and promising, I muttered to myself in yet another burst of egocentrism) being to surround the three lines near the bottom of wp-includes/widgets.php, inside the wp_widgets_init() function, that mention wp_widget_recent_entries with a

    if (!(is_home())){<<three lines of native code>>}

    but no go – I get the recent posts box on all pages.

    It brings a tear to my eye to have to abandon such an elegant, cool, drag-n-drop functionality soley because of a lack of new documentation… unless…

    Do you have a solution?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    try this. On that same file (wp-includes/widgets.php), find “function wp_widget_recent_entries($args)” and at the very beginning of that function add the snippet below so it become:

    function wp_widget_recent_entries($args) {
      if(is_home())
      return;
    
      (.. the rest of the function code..)

    It works in my case, I hope it works for you.
    Cheers.

    Thread Starter bobbeers

    (@bobbeers)

    Works great for me, too! Thanks.

    Top Cat

    (@top-cat)

    Well, how about not just return’ing, but doing something like

    return wp_widget_text();

    Is that a correct way to substitute another widget for a hidden “Recent Posts”?
    If so, how is the specific text widget selected out of all configured?

    I’ve added

    if(is_home())
    return (widget_show_ngg_slideshow($args) + wp_widget_text($args, 3));

    and it seems working 😉

    [quick shameless plug for my own plugin]

    rather than edit the widget code, use my ‘widget logic’ plugin

    http://wordpress.org/extend/plugins/widget-logic/

    This plugin gives every widget (even widgets lacking controls) an extra control called “Widget logic”.

    This text field allows you to specify any WP conditional tags logic to set when the widget appears. Use any standard Conditional Tags and even combine them.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dynamic sidebar: can I hide “recent posts” widget on the home page?’ is closed to new replies.