Glad to see I’m not the only one 🙂
I can confirm supernovae’s quick fix, however this doesn’t work with SVG images unfortunately…
You’re right, I didn’t even try it myself presuming this would work, but it doesn’t! You CAN make a whole new ACF group based upon a taxonomy term rule by the way, but that clutters up your ACF groups a lot…
I would love to see this integrated as well! I have been using Posts 2 Posts plugin for a very long time now on dozens of projects and it’s absolutely one of the best WordPress plugins hands down!
However I try to avoid using a lot of different WP metaboxes in the WP admin area for my clients. The Posts 2 Posts adds a metabox for every connection, it would be so cool to be able to add these boxes in the ACF interface with the other custom fields. Could this be possible somehow?
I would love this feature too! Now, the only way to show or hide some fields based upon the taxonomy value is to make a radio button or checkbox field and use that as the conditional logic which seems a bit of a detour…
Well, the main disadvantage of the repeater field approach in my opinion is that if you (accidentally) trash your page where the custom gallery fields are in, you loose all of your galleries. That will never happen with seperate post types.
Thanks for the update!
Although I ended up using a custom post type for this instead of a repeater field, this is a very useful piece of code!
Thanks jnicol!
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.