Home Forums Add-ons Repeater Field Single page for each repeater item


Single page for each repeater item

  • Hi,

    I have a custom post type (Artists) that collects information about an Artist. Within this CPT I have a repeater field for Artworks (image, title, description etc).

    Currently I have a single page template for each Artist and the Artworks are displayed in a listing on that page.

    How can I link each artwork to its own single detail page? I have managed to assign each artwork an ID just using php count. Just not sure how to harness that. Ideally the url would play into what I already have –

    Any help would be greatly appreciated. Thanks.

  • I have done something similar recently with a publication system for a client. Each publication can have multiple pages. I used the WP built in system that allows posts to have multiple pages, in a way. I used it because it allows me to create a unique URL for each one because WP lets me add a page number to the URL.

    What I do on the publication intro page is generate links for each page in the publication like

    • /publication-title/1/
    • /publication-title/2/
    • /publication-title/3/
    • etc…

    In my publication template I see what page is requested

    $page = 0;
    if (preg_match('#/([0-9]+)/?$#', $_SERVER['REQUEST_URI'], $matches)) {
     $page = intval($matches[1]);

    if $page == 0 I show the intro page. If $page != 0 then I show the content from the right row of the repeater.


  • Thanks for your help JH.
    I understand what you are getting but I can’t make the connection between the generated URLs and their destination template that has all the code to get the appropriate repeater row info.

    Wouldn’t clicking publication-title/1 send you to a 404 page?

  • No, this is automatically handled by WP. Here is some information on it

    The individual pages would use the same template that is being used now. You just need add detection to see what page should be shown.

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

The topic ‘Single page for each repeater item’ is closed to new replies.