Just wondering if there is anyway to render post-related data in a shortcode within the Query block?
For example, if I have this basic shortcode to display the post ID like this:
function test_shortcode_in_query() {
$my_id = get_the_ID();
return 'My ID is: ' . $my_id;
}
add_shortcode('my_id', 'test_shortcode_in_query');
When I add this shortcode within the Query Template it currently returns the the same ID (the current post/page id) for all the posts/items in the Query.
Note that this is a super basic example for a dynamic shortcode - and I know I can display the ID using Cwicly “dynamic values” But I have more complex shortcodes that pull in ACF data, manipulate it and creates outputs.
Just a little update on use of shortcodes that might be helpful:
The default Gutenberg Shortcode block is pretty clunky, gets in the way of your design in the editor and obvs has zero params for layout/spacing etc.
I reckon its better to use the Cwickly dynamic tag option to call your function (that I discovered today and is pretty epic!) - in my example function above, it would be:
{return=test_shortcode_in_query()}
Add a <p> and select its tag as <div> and it looks soo much neater on the edit page and no need to pass through a shortcode - nice!
this is cool but i get more and more the feeling that we have to work with so many workarounds because the standard Cwicly UX doesnt deliver to accomplish such standard tasks out of the box or it is in making of…i mean if i am forced to use code snippets and pure WP queries and stuff like that to just grap my product categories then where is the benefit of a highliy sophisticated site editor right now?
@Timo, I’m not sure what this specifically refers to, but you can display your product categories via a Taxonomy Terms block.
Regarding:
If you have specific requirements I recommend letting the Cwicly team know as they are extremely reliable at delivering popular features. When you raise a separate feature request or question on the discourse it will usually be addressed very quickly.
thanx yes i tried with “taxonomy terms” see below but no luck…nothing is outputted therefore i write my own WP Query and post it with a PHP Echo shortcode…that is what i meant for example…easy tasks which in my opinion must function if you want to run a dynamic site should not be part of a voting system …i think this is essential and it is also already there…but because Cwicly doesnt state if something doesnt work…it is just possible to click through all kinds of things but i am not sure if this is already part of the feasture list…so making it hard to accomnplish my tasks in a reliable time frame…