I’m afraid this could be a bug:
add_rewrite_endpoint causes front-page.php template to be ignored
Check out the Rewrite endpoints API
I think you need to change the $places
parameter into EP_ALL
and flush the permalinks again. Let me know if this works.
Did not test this, but is your homepage set as a static page or does it use the index.php?
Then try changing the second parameter of the add_rewrite_endpoint rule into EP_ALL:
add_rewrite_endpoint('productpage', EP_ALL);
Hi akdesigner, which code are you referring to?
And did you flush your permalinks?
I got my pagination working!
Working example can be found here for those who are interested: ACF repeater field pagination
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!
Hi Elliot,
Would it be possible to use the builtin WordPress $paged function instead?
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
And after the loop call the default pagination functions like this?
next_posts_link();
previous_posts_link();
An working example would be very welcome for this indeed.
Thanks a lot!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.