In Genesis Facebook group a user asked how a grid of posts can be shown below the header on single post pages in Genesis with these requirements:
- ability to set the number of posts
- the current post should not be displayed in the grid
- working pagination
What better plugin to accomplish this (esp. with the pagination requirement) than the excellent Genesis Featured Posts Combo?
Step 1
Install and activate GFPC.
Step 2
Add the following in child theme's functions.php:
// Register single-posts-grid widget area
genesis_register_widget_area(
array(
'id' => 'single-posts-grid',
'name' => __( 'Single Posts Grid', 'my-theme-text-domain' ),
'description' => __( 'For the Posts grid on single posts', 'my-theme-text-domain' ),
)
);
// Display Single Posts Grid below header on single posts
add_action( 'genesis_after_header', 'sk_posts_grid' );
function sk_posts_grid() {
if ( ! is_single() ) {
return;
}
genesis_widget_area( 'single-posts-grid', array(
'before' => '<div class="single-posts-grid widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
Step 3
At Appearance > Widgets drag a Genesis Featured Posts Combo widget into Single Posts Grid widget area and configure it to your liking.
Make a note of the Widget ID near the bottom.
Step 4
Let's
- relocate the post info from below the titles to above the featured images
- exclude the current post from the loop
for only the posts inside the specific widget from earlier step.
In functions.php add
To view the full content, please sign up for the membership.
Already a member? Log in below or here.