Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1276533

    Hi,
    I am displaying a widget via the functions.php in my child-theme. The code is

    add_action('ava_after_main_title','avia_header_top_column');
    function avia_header_top_column(){
    	ob_start();
    	dynamic_sidebar( 'teaser' );
    	$footertop = ob_get_clean();
    
    	$output  = "<div class='container_wrap' id='kopf'>";
    	$output .= "<div class='container'>";
    	$output .= $footertop;
    	$output .= "</div>";
    	$output .= "</div>";
    	echo $output;
    }

    I want to show this widget on all pages except a certain page. How could this be done?
    Thanks in advance!

    #1277542

    Hey bnetz,

    Thank you for the inquiry.

    You would have to include a conditional function in the snippet such as the is_page function. Please check the documentation for more info.

    // https://developer.wordpress.org/reference/functions/is_page/

    At the very top, you might have to do something like this.

    if(is_page(array(1, 232, 424))) return; 
    

    This cancels out the function or immediately returns nothing when the current page has the ID of 1, 233 or 424.

    Best regards,
    Ismael

    #1278446

    Thanks, Ismael, this completely solves my problem!!!

    /closed

    #1278485

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Exclude display of widget on certain pages’ is closed to new replies.