1.7 BB shortcode issues

Hi all,

The BB shortcode is perhaps my fave addition to the new version :slight_smile:

I was going through some testing to get ready for some new videos on the subject when I discovered some potential show-stoppers.

The primary one for this topic is that the BB shortcode is not honored in all themes in the widget areas, notably the WP Twenty Sixteen theme.

Create a new template/module/layout and save as such, global or not. Then add the BB shortcode for that to a text widget in 2016; all you see is the shortcode. Change to the BB theme or DWB and there is the layout/module, etc. However, the BB shortcode displays properly within the content of the 2016 page or post. The same can be said for the base Genesis theme; same as 2016.

This is just one of the issues that I have discovered while getting ready to create these new vids. The others have to do with how nested shortcodes (specifically tabs and accordions) behave; sometimes they work, and sometimes they don’t, but that’s the subject for another topic :slight_smile:

Cheers!
Lyle

Hi Lyle,

This isn’t actually an issue, it is how WordPress works out-the-box. By default, text widgets do not support shortcodes. Therefore, if you have never encountered this issue in the past, it is likely the theme you’ve used includes the following snippet:

add_filter('widget_text', 'do_shortcode');

So if you add the above code to your child themes functions.php file, the shortcode should display your row/module.

Thanks,
Danny

Hi Danny,

Actually, WP does support shortcodes, or at least the Contact Form 7 one, out of the box in text widgets :slight_smile:

Just to verify, I did a fresh install of WP 4.4.1 on my local XAMPP server. Didn’t do anything else except install Contact Form 7. Pasted the shortcode for the contact form into a text widget, and there was contact form in the sidebar of the default Twenty Sixteen theme. Placing a BB shortcode there results in just the code being displayed.

I have seen the noted filter before and thought that I may need to use it, but I knew I had had them display before in the default WP themes.

Cheers!
Lyle

Hi Lyle,

If you’re able to use a shortcode without applying that filter, it is very likely that the plugin is including the function in their plugin. :wink:

Thanks,
Danny

Hey Lyle,

I’d just like to add to what Danny said above. CF7 adds the filter only when we use their shortcode. Try adding the CF7 shortcode together with the BB shortcode, you’ll see both working fine. :slight_smile:

Ben

just found this thread… Appears that even the BB theme doesn’t work this way either

Does this mean I need to add this to functions?
add_filter(‘widget_text’, ‘do_shortcode’);

strange. I added that code to functions file, and it still wouldn’t work.
then I checked the box in text widget that says “Automatically add paragraphs” and it works…

who knew?

Hi Grant,

Can you try disabling that option again, as it should work without it. Also, this isn’t a BB Theme problem, WordPress out-the-box doesn’t allow shortcodes in the Text widget.

Thanks,
Danny

yep. works without it now. maybe was a caching isssue

thanks!

Hi Grant,

Yeah, most likely. Thanks for informing us, we appreciate it.

Thanks,
Danny