Offset for Post Grid section of Eleven40

Community Forums Forums General Discussion Offset for Post Grid section of Eleven40

This topic is: resolved

This topic contains 1 reply, has 1 voice, and was last updated by  braffenberg 1 year, 2 months ago.

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

    braffenberg
    Participant
    Post count: 6

    I recently switched over to the new Eleven40 (version 2.0). I added a few widgets at the top of the homepage. One of those widgets will be used for a Featured Post widget which will pull from all posts/categories. The Eleven40 post grid sits below that and repeats the posts that I have in the Featured Post widget above.

    Is there a way to offset the post grid? I’d like to list maybe three posts in the Featured Post widget and then have the post grid section offset by 3.

    Here’s my site (keep in mind I am working on it and it’s quite ugly at the moment):

    http://www.365Cincinnati.com

    Thanks!

    http://www.365Cincinnati.com
    #58289

    braffenberg
    Participant
    Post count: 6

    I figured it out. In case others have the same questions, here is code I added to the bottom of my functions.php page.

    add_action( ‘pre_get_posts’, ‘change_num_posts_in_grid’ );
    function change_num_posts_in_grid( $query ) {
    global $wp_the_query;
    if( $query->is_main_query() && is_home() && !is_paged() ) {
    $query->set( ‘posts_per_page’, ’6′ );
    $query->set( ‘offset’, ’3′ );
    }

    That limits the number of post grid entries to 6 (see line towards end) and then offsets the posts (see last line). A bonus is this allowed me to go in to Settings – Reading and then make the blog post pages list a larger number of posts too.

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

The topic ‘Offset for Post Grid section of Eleven40’ is closed to new replies.