Archived topic
Dynamic button link in Element
11 replies · Started by Andrew on June 30, 2021
Hey. I am wanting to have a button add a link dynamically from meta field and not having much luck. I'm making an employment site using WP-Jobmanager. In the header I want an 'Apply Now' button linking to the application URL. I can display the url meta as the button text but not the link. There is a dynamic link field but that doesn't seem to work..?
Hi Andrew,
Any particular reason why the link has to be dynamically added from a meta field? Does it vary depending on page/post?
Can you link us to a sample page in question so we can inspect the button? It may give us clues as to why it isn't working.
Let us know.
Note: Set the dynamic link field to "text" if you're using ACF. Here's a working demo of a dynamic button - https://dev-generate-press.pantheonsite.io/reviews/sample-review-1/ - check the apply now button. (pointing to https://www.google.com) Here's the setting - https://share.getcloudapp.com/jkuPOkPr
Thanks Elvin.
The link has to be dynamic as every job listing application URL is being pulled from the database.
eg. https://jobs.shiftregional.com.au/?post_type=job_listing&p=4197
Yeah that example you posted is doing what I need. I must be doing something wrong but... cant see what.
The meta field is entered correctly. I have put the value as a Headline underneath to show that there's no typo and the meta field is accessible.
This is how I'm entering data into the button...
https://jobs.shiftregional.com.au/wp-content/uploads/2021/07/Screen-Shot-2021-07-01-at-2.44.14-pm.png
Cheers, AV
Any chance you can provide temporary backend access for us to do an investigation?
You can use the private information text field to provide the details. Let us know.
Sure thing...
Beautiful. What was it?
ah my bad. Accidentally trashed my previous reply.
The link seems to be working now. I think removing the # stops it from turning into a proper link w/ href. I've added it to test - https://share.getcloudapp.com/7Kuoj9xg - and that made it work.
Although, I've conducted tests for logged out users but it doesn't seem to be working on your site. (works on mine though. must be a caching issue.)
Tht said, does the site's server have any sort of page caching? If yes, can you try clearing it out? Also, if it's served through CDN, can you try clearing its cache as well?
All good. I think it was deep caching on Siteground. Cleared that and works nicely.
Are you saying I need the # in the link dropdown? or remove it?
Ah I get what you mean. It needs something in that field to make it an "a", not a 'Span" element
Ah I get what you mean. It needs something in that field to make it an “a”, not a ‘Span” element
yes that's it. :D
Removing the # turns the element into span instead of a. :D
Great. Thanks for your help!
No problem. Glad to be of any help. :D