- This topic has 5 replies, 2 voices, and was last updated 4 years, 1 month ago by
Elvin.
-
AuthorPosts
-
February 16, 2022 at 10:44 pm #2122171
Andrew
Heya. I can’t seem to get ACF Page Link fields working in dynamic blocks in an Element.
If I set a standard text field I can get a Headline and Button linking by entering the Page URL but this is a not very user friendly. Is there any reason this would not return a page URL as per a basic text field? Thanks.February 16, 2022 at 11:20 pm #2122192Elvin
StaffCustomer SupportHi Andrew,
There’s a known bug that may be related to this.
See Tom’s workaround here – https://generatepress.com/forums/topic/container-dynamic-link-adds-invalid-link/#post-2095258
It requires a bit of PHP, here’s how to add it on your site – https://docs.generatepress.com/article/adding-php/
Let us know if you need clarification. 😀
February 16, 2022 at 11:27 pm #2122199Andrew
Thanks Elvin. That filter relates to Container links. Do I need a different filter for a button?
*edit: FYI It’s a CPT and custom taxonomy but not sure if that’s relevant. Working site is here:
https://valleyseeds.com.au/varieties/lucerne/February 16, 2022 at 11:41 pm #2122204Elvin
StaffCustomer SupportAh yes that’s right. For the button you’ll need the
generate_dynamic_element_url.Can you specify which button has the issue? So I can check for clues as to what exactly is happening to it.
To be sure if the issue is w/ how or what format the link is being returned as by ACF. 🙂
February 17, 2022 at 4:13 pm #2123423Andrew
For some reason it’s outputting the page ID, not the URL.
https://valleyseeds.com.au/varieties/deep-rooted-perennial/
If I output the value in a dynamic Headline text block it returns the post ID, not the URL. If I try and add it as a button link it just returns the current url.I can’t work it out – the ACF function should be returning the url as per the documentation
https://www.advancedcustomfields.com/resources/page-link/I might just try and render this button out using a shortcode.
February 17, 2022 at 10:34 pm #2123624Elvin
StaffCustomer SupportI might just try and render this button out using a shortcode.
That can work. But to solve the issue directly, we can continue with the debug.
Can you do a var_dump() of this page’s meta? particularly, the key used for page link?
Something like
var_dump(get_post_meta(get_the_ID(),'key_of_page_link',false));and have it displayed on the front-end so we can analyze it. -
AuthorPosts
- You must be logged in to reply to this topic.