Tell us what you are trying to do?
I need to create a reusable button block that I can use at multiple places on my site.. but the link and text for the button would change everytime.. I just need the background colour and the hover, normal and active attributes to be stored .. as otherwise I have to do this everytime..
But when create a reusable block it stores the link data too.. and I want that at each time I use block I should be able to change the link but the earlier blocks I had created should not get affected.. How do I do this? It seems simple and maybe I am missing something very silly and obvious but I've really tried to figure out and I can't seem to find it..
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site? hidden link
Hello,
I assume we are talking about Toolset Button block, it is possible to setup "Dynamic Button Text" and "Dynamic Button URL", see my screenshot ts-button.JPG
Hi Luo
I didn't realize that button had this option.. it's good to know..:-)..
But my requirement is different.. I want to be able to use the block and change the link when I use it on a page or post .. but it should not affect the place where it has been used previously..
Fir example I want to create a 'View Collection's button.. and every time I use this button the colour and text is the same.. but the link would need to point to a different collection.. can I do this?
Regards,
Alim
I have tried it in my localhost with a fresh WP installation + the latest version of Toolset plugins, it works fine, you just need to setup the button color and text to static value, and setup the button link as "Dynamic Button URL", see my above screenshot
Hi Luo
But even if I add a dynamic link, the link would have to be a custom field .. right?
I want to be able to add a URL that's not from a custom field.. it could be from another site ...
The link that I would add each time would be not related to the current site ... Would that be possible?
Regards,
Alim
There isn't such kind of built-in feature within Toolset Button block, but there is a workaround, you can setup a custom URL field, store the link of other website, and use it as link of Toolset Button block, so it will be populate with the link dynamically.
Sounds good to me.. will try it..:-)..
So far I've used toolset to only create custom fields on custom posts.. have never created a custom field on the main POSTS or PAGES.. am sure it's possible.. will try it out..
Thanks Luo..:-)...
Regards,
Alim
OK, please let me know if you need more assistance for it.
Hi Luo
I've created 2 custom fields
Button Text
Button Target URL
and I've created a reusable block for the button.. but the button shows up with a message
This dynamic source returned no content.
It's late today.. but tomorrow morning, I'll try to give you access and explain in detail the issue.
Regards,
Alim
I have tried it in my localhost, it works fine, please provide your website credentials, also point out the problem page URLs, thanks
Thanks for the details, I can login your website, in the problem post you mentioned above:
hidden link
There isn't custom field "Button Text" and "Button Target URL", so it is expected result:
This dynamic source returned no content.
You need to make sure current post have above custom fields, for example create another post put that reusable block into the post content, it works fine, see it in your website, button "read more 2":
hidden link
Hi Luo
Thanks for the update
I did create a new post
hidden link
and it's still not showing.. as you can see here
hidden link
And the Button Text and Button URL are present in the fields
Secondly this link below
hidden link
When I am editing the above link I can't see the custom fields Button Text and Button URL.. as you can see in the screenshot below
https://toolset.com/wp-content/uploads/tmp/Screen_Shot_2020_10_15_at_10.00.32_PM.png
I can edit the block and find the custom fields when I edit it from within a post but not from the above link.. is this how it is? I mean I should edit it from within the post only?
If you are creating another test post.. please backdate the publishing date to 2019 so that it doesn't appear on the home page..:-)..
Regards,
Alim
Your website is abnormal, please check the problem post you mentioned above:
hidden link
I have added a simple paragraph: 1234567, save and test it in front-end:
hidden link
It does not output simple paragraph or anything of post content in front-end.
There should be other compatibility issues in your website, please check these:
1) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again
2) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/
Hi Luo
I checked the link you provided and I am able to see the paragraph (screenshot attached)
hidden link
I have not made any changes to the site.. in fact I was planning to delete the reusable block to test if that's the culprit.. and when I create newer posts, there's no issue..
Can we look at the problem link first and see what the issue is? and not the post.. I am mean the link where the reusable block is edited..
hidden link
This is a toolset block post and not a wordpress post..
If you need to use a staging server for this, do let me know and I can create one for you..
Regards,
Alim
For the URL1:
hidden link
Please open it in your browser, you should be able to see:
There isn't custom field "Button Text" and "Button Target URL", so it is expected result:
This dynamic source returned no content.
And I have tried it again in your website:
hidden link
setup the text to 123...0
It does not display in front-end, see my screenshot: button2.JPG
So your website is abnormal, please check as I mentioned above:
https://toolset.com/forums/topic/create-a-reusable-button-block/#post-1813411
And please let me know if you need assistance to setup a test site to show you a demo