Skip Navigation

[Resolved] Use square brackets as separator into wpv-post-taxonomy shortcode

This support ticket is created 2 years, 6 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 – 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)

This topic contains 2 replies, has 2 voices.

Last updated by romanB-3 2 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2414833

In the wpv-post-taxonomy shortcode, I need to use square brackets into the "separator" argument.
But as soon as I do so, the shortcode breaks down.
Thanks.

#2415257

Hello,

There isn't such kind of built-in feature within Toolset plugins, the square brackets characters are reserved by WordPress shortcode API, so you can not use them as shortcode attribute values.
As a workaround, you can create another shortcode to replace the separators as what you want, for example:
1) Add below codes into your theme file "functions.php"

add_shortcode('my-replace', function($atts, $content){
	return $res = str_replace('|', '[', do_shortcode($content)); // replace [ with what you want
});

2) use above shortcode to wrap wpv-post-taxonomy shortcode, like this:
[my-replace][wpv-post-taxonomy type="category" separator="| "][/my-replace]

#2415263

My issue is resolved now. Thank you!