"Info Box' on blog page only

Community Forums Forums Design Tips and Tricks "Info Box' on blog page only

This topic is: not resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  SoZo 1 year, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3839

    sambish
    Participant
    Post count: 2

    Hi i’ve managed to inset a info box on my site using the following code:

    /** Sidebar before posts */
    genesis_register_sidebar( array(
    ‘id’ => ‘before-posts-sidebar’,
    ‘name’ => ‘Before Posts’,
    ‘description’ => ‘This is a sidebar that goes before the posts in the #content.’,
    ) );
    add_action( ‘genesis_before_loop’, ‘child_before_posts_sidebar’ );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {

    echo ‘<div class=”before-posts-sidebar”>’;
    dynamic_sidebar( ‘before-posts-sidebar’ );
    echo ‘</div>’;

    }

    However it is showing up on all of my pages & posts. I want it to show on my blog page only – I know I need to use a conditional tag but i’m having difficulty knowing where to include it in the code. Please can someone help! Many Thanks

    #14859

    SoZo
    Moderator
    Post count: 1573

    It would go around the content you want to output, e.g.
    [php]
    function child_before_posts_sidebar() {
    if ( is_page(’1′) )
    echo ‘<div class=”before-posts-sidebar”>’;
    dynamic_sidebar( ‘before-posts-sidebar’ );
    echo ‘</div>’;
    }[/php]


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.