Display the same post multiple times based on custom fields group

Support General Display the same post multiple times based on custom fields group

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #44865
    EugeneEugene
    Participant

    Hi,

    Maybe it's a silly question nut I can't figured out.
    Is it possible to display the same post multiple times based on amount of custom fields?
    I'm trying to avoid duplicating the posts.

    For example: I have "Events" CPT. Each "event" contains a number of repeatable group of custom fields.

    Event 1
    -- event date 1 + button
    -- event date 2 + button
    -- event date 3 + button

    Event 2
    -- event date 1 + button
    -- event date 2 + button

    ...and so on.

    It's not a problem to display each event with all the custom fileds at once.

    But, is it possible to query, sort (by date) and display each event with each date separetly?

    Event 1 / event date 1 + button
    Event 1 / event date 2 + button
    Event 1 / event date 3 + button
    Event 2 / event date 1 + button
    Event 2 / event date 2 + button

    Sorry if it's not a relevant question.
    Maybe it's not possible in that way?
    Point me in right direction, please.

    Thanks in advance.

    #44873
    PeterPeter
    Moderator

    Hello Eugene,

    I think you can use the WP Query to query posts with the custom field parameter, please follow the documentation https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters

    Note: It's difficult to query posts based on the subfield value in a group field. The purpose of the group field is to store data, not for query. Following this article https://metabox.io/create-group-of-custom-fields-with-meta-box-group/#how-does-the-meta-box-group-save-data

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