Using Toolset I can add to my sidebar a field that is not generic but specific to the current custom post type being displayed. For example, I can display on the sidebar an standard field such as the post excerpt.
For regular posts I could even select custom field groups (like “Other fields”) to be displayed on the sidebar. However, I can´t find a way to select custom fields for a particular CPT to be displayed on the sidebar.
It does not seem to make sense to me that I can use the Toolset´s Single Field block to display on the sidebar standard post fields from my CPT, or even custom fields groups created by WP core on any standard or custom post, while I can´t select any custom field created with Toolset for my CPT. Or am I doing anything wrong?
Hello and thank you for contacting Toolset support.
WordPress has introduced the ability to build Widgets(usually used in sidebars) using the blocks editor. I assume that's what you are trying, right? If not, can you elaborate more on what you are trying to do?
If yes, I think that the Toolset Dynamic sources are unable to get the proper context(the CPT) to get the corresponding custom fields.
Create a content template for that custom post, use a lower priority on it, so it does not get picked for that custom post type. Then, create the single field that you want, and make it a reusable block. Then get back to the widget and use that reusable block.
You can then, remove the content template that you used to create the reusable block. Does it make sense?
Hi, Jamal, and thank you for your answer. Yes, I´m trying to build a widget for my sidebar using the block editor.
I tried what you proposed and created a reusable block. But unfortunately the block editor does not allow me to add a reusable block to the widget, only normal blocks. I don´t know why this happens, but on the block inserter I don´t get the regular Block/Patterns/Reusable tags, just the block search field and then the normal blocks underneath.
Thank you for your feedback. I did not manage to get Gutenberg working for widgets in my local test setup. So, I assumed reusable blocks can work on it.
I created a new test site here hidden link
I find out that Toolset Blocks does not support the widgets yet. We have a feature request for it, so I am adding this ticket to it to follow up on it later.
As a workaround, you can use the Toolset shortcodes in a Shortcode block, or in an HTML block. Check the footer widget here hidden link
You can see how I display the custom field(subtitle) in different ways. Using two shortcodes from Toolset, and also using a content template. Check this screenshot hidden link
The content template is here hidden link
I hope this helps. Let me know if you have any questions.
Thanks, Jamal.
Let´s hope that Toolset Blocks support for widgets comes soon. Meanwhile, the workarounds you proposed do work.
My issue is resolved now. Thank you!