Support

Account

Home Forums Add-ons Repeater Field Advanced Custom Repeater Field Page Navigation Reply To: Advanced Custom Repeater Field Page Navigation

  • Hi Elliot,

    Thanks for your reply, I know it isn’t a ‘regular’ wordpress query. I’m just trying to get it working like one.

    I got my following code working with a custom query_var called albums: Pastebin
    And I can use the url: http://mydomain.local/pagename/?albums=2

    The last thing I want to achieve is a rewrite rule for the query var, but somehow that isn’t working yet. I would like an url like this: http://mydomain.local/pagename/page/2/

    /* Photo albums pagination parameter */
    function add_albums_query_var(){
    	global $wp;
    	$wp->add_query_var('albums');
    }
    /* Rewrite rules albums pagination */
    function add_albums_rewrite_rule() {
    	add_rewrite_rule('^/page/([0-9]+)/?$', 'index.php?p=25&albums=$matches[1]', 'top');
    }
    add_filter('init', 'add_albums_query_var');
    add_action('init', 'add_albums_rewrite_rule');

    25 is the page id where the repeater field is looped.
    Any idea why this isn’t working?

    Thanks a lot!