Button Dynamic Content Url

Hello! I am working on a global block for certain custom posts. Is there a way to use one of the custom fields of the post as a link on button?

For example, the name of my custom field is “instagram”, I am trying adding on the button url: {{dc:looper:field key=“instagram”}}, but it doesnt work :sweat_smile:.

Thank you!

Hello @flgv,

Thanks for writing to us

In case you want to pull any specific post’s meta field value, please add this dynamic content code.

{{dc:post:meta key="your_key" post="specific _post_ID"}}

If it doesn’t work for you, please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin level username and password
  • Exact post URL, Global Block URL, and Custom field

You can find the Secure Note button at the bottom of your posts

Thanks

Hello @prakash_s ! Thank you for your answer, I am trying to use custom social links to different posts, i tried with {{dc:post:meta key=“instagram” post=“post_id”}} (The meta key is “instagram”) but it didnt work. I add the link as a secure note, thank you!

Hi @flgv,

We need to check the settings, the post meta values, and how you are fetching that through the Dynamic Content tag. For that reason, please share the login details of your website in the secure note as asked by my colleague.

Thanks

Sure! i left the details in a secure note. Thank you!

Hello @flgv

Thanks for sharing the login details I went ahead and checked your settings it seems that you have not added the post ID. I would suggest you replace your dynamic content code with this one.

{{dc:post:meta key="instagram" post="post_ID"}}

Replace the code

{{dc:post:meta key="instagram" post="12743"}}

Please let us know how it goes.
Thanks

Thank you @prakash_s! When i add the post ID the button breaks (see the image below). Is there a way to add a code for all the custom posts? because adding each post ID will be impossible one by one.

theme.co file

Hello Fede,

To use it dynamically, you can just insert this {{dc:post:meta post="post_id" key="instagram"}}. This will ensure that it will always display whatever is added in the Instagram custom field of the current post that you are viewing. Just make sure that your post meta key is correct or it will not display anything.

I also check your custom field and as it turns out, it will output like this: <a href="https://instagram.com/laguiaveg" target="_blank" rel="noopener noreferrer">instagram.com/laguiaveg</a> which means that you cannot use the dynamic content {{dc:post:meta post="post_id" key="instagram"}} as the link in your Button element.

You can test it out by adding a Text element and insert this:
<p><strong><span style="font-family: futura-medium;">Instagram:</span></strong> [field "instagram"]</p>

To get this resolve, please edit your custom field settings and make sure that whatever you insert in the field will be the same output and not a generated link as the output.

Hope this makes sense.

Thanks a lot! it worked for me like this: {{dc:post:meta key=“custom_key”}}

You are most welcome, Fede!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.