• Resolved Howdy_McGee

    (@howdy_mcgee)


    Hello!

    I believe that the conditional on be-subpages-widget.php Line 53 should read:

    if ( !is_singular( $post_types ) || !apply_filters( 'be_subpages_widget_display_override', true ) )

    Instead of &&, and instead of false. So if either of the test are true, the widget drops and returns nothing to display. Otherwise the filter simply never fires.

    Usage example includes:

    /**
     * Don't display subpages on this specific page
     *
     * @param Boolean $show - Whether to show the Widget
     *
     * @return Boolean $show
     */
    function mod_be_subpages_widget( $show ) {
    	
    	global $post;
    	
    	if( is_object( $post ) && 6 == $post->ID || 6 == $post->post_parent ) {
    		$show = false;
    	}
    	
    	return $show
    	
    }
    add_filter( 'be_subpages_widget_display_override', 'mod_be_subpages_widget' );
    • This topic was modified 7 years, 8 months ago by Howdy_McGee.
    • This topic was modified 7 years, 8 months ago by Howdy_McGee.
Viewing 1 replies (of 1 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    That filter is not for turning the widget OFF in certain contexts, but rather for turning it ON even if is_singular() is false.

    For instance, you may have a hierarchical post type called ‘training’. On the individual posts the shortcode will appear, but by default it won’t appear on the post type archive. This filter lets you turn it on.

    To disable the widget on a page that it normally would appear on, I’d either (a) load a different sidebar on that page, one that doesn’t have the widget; or (b) use the be_subpages_widget_parents filter to specify an incorrect ID (ex: a post ID that doesn’t exist, or a page that has no children).

Viewing 1 replies (of 1 total)
  • The topic ‘Display Override Filter’ is closed to new replies.