Site logo

[Support request] Group custom post type items by year

Home Forums Support [Support request] Group custom post type items by year

Home Forums Support Group custom post type items by year

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2552535
    Daniel

    Hello

    I want to make a web in which the entries of a CPT are shown grouped by years as in the image.

    Posts grouped by year

    I need the list to be dynamic and when I classify the entries in the corresponding year the whole structure is generated in the frontend. That is, I can’t use the query loop block to create the listings by year.

    I understand that it can be done but it will require some custom code, can you give me an indication of what WP or GP functions I have to look at to do it?

    #2552687
    David
    Staff
    Customer Support

    Hi there,

    to do that automatically would require a nested loop, ie. a loop within a loop.
    And thats not something that the Query Loop supports just yet, its a future Pro feature.

    Does it need to be dynamic?
    Considering the intervals are yearly, updating that page once a year to duplicate the query loop and change its Data Parameters is all that would be required.

    Let me know

    #2558381
    Daniel

    Thanks for the answer David,

    The listing does need to be dynamic, as it is to group old movies by their release year.

    I’ll look for information on nested loops and I’m sure I’ll find what I need.

    Best regards!

    #2558488
    David
    Staff
    Customer Support

    There are some forum support topics for similar requests.
    I can take a look for something relevant if you want?
    Main question here would be if / how the page is paginated? As that can add an extra layer of complexity to nested loops.

    Let me know

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.