Support

Account

Home Forums General Issues Repeater field into a page? Reply To: Repeater field into a page?

  • Hi @kyon147

    If you have only small amount of the wiki pages and you don’t need the pretty permalink (pretty permalink: http://example.com/link-to/the-page/, plain permalink: http://example.com/?linkto=thepage), then you can do it.

    What you need to do is to get the URL parameter in the plain permalink and use it to show the row you want. Maybe something like this:

    // Current URL: http://example.com/?linkto=thepage
    
    // Get the slug of the current page ('thepage')
    $page_name = (isset($_GET['linkto'])) ? $_GET['linkto'] : false;
    
    // If the slug exists
    if( $page_name ){
        
        // Get the repeater data
        $repeater = get_field('wiki_repeater_name');
        
        // We need to set the wiki slug as an array key, so we need a second
        // variable to hold the new repeater data
        $modified_repeater = array();
        
        // loop through the repeater and set the array key
        foreach( $repeater as $item ) {
            $modified_repeater[$item['wiki_slug_subfield']] = $item;
        }
    
        // Show the data
        echo $modified_repeater[$page_name]['wiki_title_subfield'];
        
        // user print_r() to see how the data looks like:
        // print_r($modified_repeater);
    }

    That being said, I still suggest you use a post for each wiki page instead.

    I hope this helps 🙂