Skip Navigation

[Resolved] Button with dynamic text inside a View Loop

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 21 replies, has 2 voices.

Last updated by Arno 2 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2353579
toolset-button-ok.jpg
toolset-button-issue.jpg

Hi,

I have an issue with the Button block inside a View Loop. The button should have a dynamic button text, pulled from a field of another post. The button also has a dynamic button URL and it opens in a new window. The button works fine without the dynamic button text. With the dynamic button text, it does not render.

You'll find the working and non-working Button settings attached.

#2353639

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

Thank you for getting in touch.

Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

Please where applicable please provide me with a link to an example page where I can see the issue.

I've enabled the private fields for your next response.

Thanks,
Shane

#2353659

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

When I check the Dynamic text source for the button there wasn't anything selected.

I've now selected an option and the buttons are now showing on the frontend as intended.

Thanks,
Shane

#2353709

Hi Shane,

Yes, I see. But you've selected the current post title as the dynamic text. What I need though, is the text from:
Post source: other post
Post: "Website settings"
Field: "Msg: read more"
(see my screenshot for the result in the editor after selecting all of the above)

I have configured that multiple times but the button won't render. Since you did not see anything selected, that might be the problem: if selecting another post, the settings do not get saved.

I just configured it again and the button is gone again, from the frontend.

Kind regards,
Arno

#2353747

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

I'm not seeing the field that you want to pull the data from on the Promotions post type.

Currently these are the fields that are assigned to the Promotions CPT.
hidden link

Only the fields that are on the post type can be displayed here. The Website Settings custom fields are not assigned to the Promotions CPT.

This is perhaps why no data is being shown.

Thanks,
Shane

#2354079

Hi Shane,

For the button dynamic text, I don't want to pull data from the Promotions post type. I set Post Source to "Other post" and then selected the post called "Website settings" and the field called "Msg: read more". I do this in many other views too and it works fine. This is the first time I do this in a button and then it fails.

In fact, I just added a Single Field block to the same View Loop, selected the desired fields, and that works fine too. It now displays the text "Read more now" in the frontend. Please check it out.

It's only the button which is failing. It does not render. I think it fails to store the settings somehow if I pull data from "Other post" instead of the posts we're looping through.

Do you see what I mean?

Thanks,
Arno

#2354453

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

I understand what you mean now.

It would appear that on the backend it is pulling the data fine but on the frontend that data isn't being rendered.

Would it be possible to temporarily disable all the non-toolset plugins and check again to see if the problem here is being caused by a plugin conflict?

Please let me know.
Thanks,
Shane

#2354693

Hi Shane,

I managed to reproduce the problem on the staging site with no other plugins than Toolset and the 2022 theme. The page is hidden link. It should have a button below the image but it's not there.

I think this is needed to reproduce it:
A view inside a template, and the template is used in a page. With a view in a page there was no problem, it needs to be a template.
A button in the view loop with a dynamic text pulled from a custom field in another custom post.

Please try to reproduce it, or I can give you access to the staging site again.

Thanks,
Arno

#2354739

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

Please provide the access for the staging site. I will grab a copy and escalate to our 2nd tier support team.

It seems the issue is only affecting the custom field values but the default post fields such as the post title work fine.

THanks,
Shane

#2355467

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

I did a quick test for this on a sandbox site to see if it can be replicated on a fresh install.

I wasn't able to replicate it, however can you view and let me know if the setup is exactly or similar to the one i've setup.
Here is the sandbox site.
hidden link

Secondly here is the page that i've setup the example
hidden link

Thanks,
Shane

#2355511

Thanks Shane. Your test is directly inside a post. What you need is a view inside a Content Template, and then use that template in a page (a post may work as well).

#2355709

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

I did a closer setup to the one you have and the issue still isn't there.
hidden link

Can you check to see if I've missed any steps and if so can you attempt to replicate on the sandbox site?

Thanks,
Shane

#2355999
toolset-sandbox-button.jpg

Hi Shane,

When I open the template it looks like no source has been selected for the dynamic text (see attachment). Not sure what that's about but if you did select a source, the setting was lost somehow (and that might be similar to the issue I have!).

If this does not help, do you allow me to setup an example in your sandbox site, or tweak the one you have?

Thank you,
Arno

#2356325

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Arno,

Yes you can go ahead and setup the example on the sandbox site since this is something that we can share with our 2nd tier if you're able to replicate.

Please let me know once you've replicated the issue on the sandbox site.

Thanks,
Shane

#2356453

Hi Shane,

I reproduced it. I changed two things: I used a custom post type (Cars) to output in the view, instead of a standard post. And I created another custom post type with a Single Line field to pull the dynamic button text from. The button does not render: hidden link. I have used this same approach in other blocks where it works perfectly. So it looks like a bug in the Button block.

I hope this helps to fix it.

Thank you,
Arno