Conditionally modifying the genesis loop?

Community Forums Forums General Discussion Conditionally modifying the genesis loop?

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  jcole 2 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #33835


    I’m new to Genesis and working on a custom view of the individual category pages.

    I need to modify the default Genesis loop on the category archive pages in the following ways:

    1) Under certain conditions display posts 6-9 on any given category archive page. The reason for this is that I’m featuring a post slider for posts 1-5.

    Is there a recommended way of modifying the post query conditionally to include posts 6-9, and still have pagination work properly?

    2) Add a “last” post class to the last post in the loop. I need to format the last post on the page differently in CSS. Is there an easy way to do this?

    I was thinking that something like this might work, but I’m not sure how to conditionally tie into the last post in the post query:

    add_filter('post_class', 'custom_post_class');
    function custom_post_class($classes) {
    $new_class = 'last';
    If last post in result set
    $classes[] = esc_attr(sanitize_html_class($new_class));
    return $classes;

    Thanks for any assistance.




    Hi John,

    This post should help you replace the loop:

    And this post might give you some ideas for the offset, the Genesis Grid loop has a features option and then offsets the standard listing:

    Let me know if that helps.


    Twitter: cehwitham Web:



    Thanks Chris!

    I came across those and similar posts and ended up using a custom loop to get it all working.


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

You must be logged in to reply to this topic.