This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Show sidebar on single posts

  • Creator
    Topic
  • #10008
    Robert Piller
    Participant

    Hi, can you help me display the right sidebar on single posts? This function isn’t working:

    // Show sidebar on single posts
    function single_post_sidebar_layout( $sidebar_layout ){
    	if( is_single() && get_post_type() == 'post' )
    		$sidebar_layout = 'sidebar_right';
    }
    add_filter( 'themeblvd_sidebar_layout', 'single_post_sidebar_layout' );

    Thanks!

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #10027
    Jason Bobich
    Keymaster

    Hello,

    Remember that when you’re filtering something, you always need to return it at the end of the function, or else you’re not sending anything back through the filter.

    // Show sidebar on single posts
    function single_post_sidebar_layout( $sidebar_layout ){
    	if( is_single() && get_post_type() == 'post' )
    		$sidebar_layout = 'sidebar_right';
    
    	return $sidebar_layout;
    }
    add_filter( 'themeblvd_sidebar_layout', 'single_post_sidebar_layout' );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.