Saltar navegación

[Resuelto] Create a reusable button block

This support ticket is created hace 4 años, 3 meses. 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Etiquetado: 

Este tema contiene 16 respuestas, tiene 2 mensajes.

Última actualización por AlimB3245 hace 4 años, 2 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1810195

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? enlace oculto

#1810791
ts-button.JPG

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

#1810817

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

#1810867

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

#1810969

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

#1810989

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.

#1811001

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

#1811015

OK, please let me know if you need more assistance for it.

#1811267

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

#1811809

I have tried it in my localhost, it works fine, please provide your website credentials, also point out the problem page URLs, thanks

#1811999

Thanks for the details, I can login your website, in the problem post you mentioned above:
enlace oculto

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":
enlace oculto

#1812485
Screen Shot 2020-10-15 at 10.00.32 PM.png

Hi Luo

Thanks for the update

I did create a new post

enlace oculto

and it's still not showing.. as you can see here
enlace oculto

And the Button Text and Button URL are present in the fields

Secondly this link below
enlace oculto

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

#1813411

Your website is abnormal, please check the problem post you mentioned above:
enlace oculto
I have added a simple paragraph: 1234567, save and test it in front-end:
enlace oculto
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/

#1813571
Screen Shot 2020-10-16 at 5.10.22 PM.png

Hi Luo

I checked the link you provided and I am able to see the paragraph (screenshot attached)

enlace oculto

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..
enlace oculto

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

#1813607
button2.JPG

For the URL1:
enlace oculto
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:
enlace oculto
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