Community Forums › Forums › Archived Forums › Design Tips and Tricks › Ordering Content Before Comments Help
- This topic has 7 replies, 2 voices, and was last updated 10 years ago by itarsenal.
-
AuthorPosts
-
March 31, 2014 at 7:06 am #97601itarsenalMember
Howdy,
I'm trying to order content before the comments - two registered widget areas and an author box. I thought the priorities would handle this but they don't seem to be doing the trick, can someone help point me in the right direction, or just glance over these code snippets I'm using in functions.php?
Thank you!
==========/**output the after post widget content**/
function poster_footer() {
//is_single() restricts it to individual posts and is_activesidebar only writes anything if the sidebar actually has content to write
if ( is_single() && is_active_sidebar( 'after-post' ) ) {echo '<div id="after-post">' . PHP_EOL;
dynamic_sidebar( 'after-post' );
echo '</div>' . PHP_EOL;
}
}
//Execute the widget area right before the comments section
add_action( 'genesis_before_comments', 'poster_footer', 9 );//Register after post widget
genesis_register_sidebar( array( 'id' => 'after-post', 'name' => __( 'After Post', 'ihq' ), 'description' => __( 'This is the section after a post.', 'ihq' ), ) );/**output the 2nd after post widget content**/
function poster_footer2() {
//is_single() restricts it to individual posts and is_activesidebar only writes anything if the sidebar actually has content to write
if ( is_single() && is_active_sidebar( 'after-post2' ) ) {echo '<div id="after-post2">' . PHP_EOL;
dynamic_sidebar( 'after-post2' );
echo '</div>' . PHP_EOL;
}
}
//Execute the widget area right before the comments section
add_action( 'genesis_before_comments', 'poster_footer2', 9 );//Register 2nd after post widget
genesis_register_sidebar( array( 'id' => 'after-post2', 'name' => __( '2nd After Post', 'ihq2' ), 'description' => __( 'This is another section after a post.', 'ihq2' ), ) );/** Add Genesis Author Box on Single Pages**/
add_action('genesis_before_comments', 'genesis_do_author_box_page', 15 );
function genesis_do_author_box_page() {
if ( !is_page() )
return;if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}}
April 1, 2014 at 9:08 am #97891Davinder Singh KainthMemberIs the format like this as of now:
Post title
Content
Widget Area
Author BoxWhich order of widgets you are trying to achieve?
Sunshine PRO genesis theme
Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis ThemesApril 1, 2014 at 9:46 am #97916itarsenalMemberAh sorry, I'd like to know how to move them all around for future reference, but for this example, I'd like the author box below the widgets, or at least one of the widgets.
April 1, 2014 at 8:50 pm #98009itarsenalMemberAny follow up on this? I need to know how to order these elements.
-r
April 1, 2014 at 11:49 pm #98016Davinder Singh KainthMemberDo you notice 9 and 15 in above code? That number is used to define priority of widgets display. Change that number(s) as per requirement.
Sunshine PRO genesis theme
Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis ThemesApril 2, 2014 at 6:41 am #98050itarsenalMemberYes, I do notice them, I referenced them in my first post.
The 9 should be putting the widgets before the author box, but that is not happening, and is exactly what I'm trying to troubleshoot here. The author box is still showing up first.
April 4, 2014 at 12:16 am #98404Davinder Singh KainthMemberIn widget add action code use different hook: like one after content area and then check. Refer this http://genesistutorials.com/visual-hook-guide/ if using Genesis 2.0 HTML5 theme
Sunshine PRO genesis theme
Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis ThemesApril 4, 2014 at 9:18 am #98460itarsenalMemberThanks, that totally helped, used a diff hook to solve the issue.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.