Adding widget area above and below indiv posts

Community Forums Forums Design Tips and Tricks Adding widget area above and below indiv posts

This topic is: not resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  braddalton 12 months ago.

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

    Deluxe Designs
    Participant
    Post count: 3

    Hello –

    The test site I am working on is: http://www.deluxe-designs.net/jamerrill

    I have added the following in my functions file:

    /** Add Section for Above Single Post */
    add_action( 'genesis_before_post', 'before_post');
    function before_post() {
    echo '<div class="beforepost">';
    dynamic_sidebar( 'before-post' );
    echo '</div><!-- end .before_post_area -->';
    }
    
    genesis_register_sidebar( array(
         'id'          => 'before_post',
         'name'          => __( 'Above Single Post Area' ),
         'description'     => __( 'This is the above single post area.' ),
    ) );
    
    /** Add Section for Below Single Post */
    add_action( 'genesis_after_post_content', 'after_post');
    function after_post() {
    echo '<div class="afterpost">';
    dynamic_sidebar( 'after-post' );
    echo '</div><!-- end .after_post_area -->';
    }
    
    genesis_register_sidebar( array(
         'id'          => 'after_post',
         'name'          => __( 'Below Single Post Area' ),
         'description'     => __( 'This is the below single post area.' ),
    ) );
    

    and have css for both widget areas.

    The widget areas show up in my dashboard however the content does not appear. Is there a reason why this would be? I am using the balance theme and not HTML5.

    Thanks

    http://www.deluxe-designs.net/jamerrill
    #69012

    braddalton
    Participant
    Post count: 10234

    Your code has a couple of errors.

    You can use this code http://wpsites.net/web-design/adding-new-widget-areas-in-studiopress-themes/

    Or you can fix your code by making sure the i.d’s match

    [php]
    dynamic_sidebar( ‘after-post’ );

    ‘id’ => ‘after_post’,
    [/php]

    One has an underscore and the other a hyphen. They both need to match


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

You must be logged in to reply to this topic.