Site logo

Archived topic

URL link in Elements Dynamic Data not working as expected

9 replies · Started by Maria on March 31, 2023

Viewing posts 1–10 of 10

Don’t know what I’m missing. What I want to happen: When visitors click on “Get this typeface” link, they should be taken to the page to buy the font. Instead, they remain on the same page.

Steps taken:
Created Custom Post Type
Created field in ACF using URL field type
Created Block Element > Content Template
Element > Display Rule set to the CPT
Element Type > Content Template
Enabled Dynamic Data
Data Source > Current Post
Link Source > Post Meta
Post Meta Field > Fields Name

https://www.screencast.com/t/TSuAJYVWj
Page: https://demo.mariajacksondesign.com/typeface/test-typeface/

Sorry I should have highlighted this:

<a href="#">
    "Get this typeface
    <span class="new-tab-icon">«</span>
</a>

Where does that content come from ?

OK, remove that HTML as it will break the string replacement.

Just add the Headline block with some text, and a link, and then add the dynamic data.
Does that work?

Then we can look at adding icon.

I removed the HTML, added the headline block and added the dynamic data. It now works as expected, but how do I add the target="_blank" attribute to open in a new window? I tried using the ACF field type Link, which gives the option to open in new window, but it doesn't work. Not sure if this is a question for ACF.

The field type URL now works, but doesn't open in new window. The field type Link gives option to open in new window, but goes to 404 page. https://www.screencast.com/t/3jd6whG2y

That works beautifully! Thanks to you both, David and Fernando.

You're welcome, Maria!

This archived topic is closed to new replies.