WPIntell

Source evidence

Shortcodes not executing in FAQ post

FAQ Concertina · support · 2016-04-21T16:09:00+00:00

mixedsentiment
highseverity
0.94relevance
5replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

2 / 18 rows with source links

11.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

16 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
yosempai resolved
Hi, when trying to use any shortcode in the body of an FAQ answer, it just displays the shortcode instead of executing it. The shortcodes work fine when viewing an individual FAQ answer, but when using [faq-concertina] to display the accordion, shortcodes don’t function within the answer. Is this a known issue? Is there anything I can do to get around it? Thanks! https://wordpress.org/plugins/faq-concertina/ Try adding this line to the functions.php file of your theme: add_filter( 'the_content', 'wpautop', 20 ); Please let me know if that works. regards Michael Hi Michael, I added that line to my functions.php, but that didn’t seem to work. Here is a page with an example FAQ: http://old.zagerguitar.com/test/ I’m using a simple shortcode to display the date as an example…you can see that the shortcode works on the page, but not in the FAQ accordion. Theres also a link to the individual FAQ post page. I use the wpautop function when displaying the answer so that it is formatted correctly (ref. line 752 of faq-concertina.php in current version – 1.2.2). The line above causes wpautop to be executed after shortcodes. Here is a link to an article which I believe explains the problem you are having: http://customcreative.co.uk/resolving-wpautop-and-shortcodes/ I hope this helps you to solve the problem. regards Michael Changing the priority of wpautop didn’t do the trick. However, I found this post on Stackoverflow that says You could also do $content = get_the_content(); echo apply_filters(‘the_content’, $content); which will pass the unfiltered content returned by get_the_content() through the default filter used on the_content() So for a quick hackish fix, I modified line 752 in faq-concertina.php to read: $content = get_the_content(); $faq_concertina .= wpautop( apply_filters('the_content', $content) ); And now my shortcodes work! Thanks for the info. I’ll test that out and possibly incorporate it into the code. Glad things worked for you in the end. regards Michael

Comments

5 shown
Michael Burridge 2016-04-21T19:23:00+00:00

Try adding this line to the functions.php file of your theme: add_filter( 'the_content', 'wpautop', 20 ); Please let me know if that works. regards Michael

yosempai 2016-04-21T21:22:00+00:00

Hi Michael, I added that line to my functions.php, but that didn’t seem to work. Here is a page with an example FAQ: http://old.zagerguitar.com/test/ I’m using a simple shortcode to display the date as an example…you can see that the shortcode works on the page, but not in the FAQ accordion. Theres also a link to the individual FAQ post page.

Michael Burridge 2016-04-21T22:29:00+00:00

I use the wpautop function when displaying the answer so that it is formatted correctly (ref. line 752 of faq-concertina.php in current version – 1.2.2). The line above causes wpautop to be executed after shortcodes. Here is a link to an article which I believe explains the problem you are having: http://customcreative.co.uk/resolving-wpautop-and-shortcodes/ I hope this helps you to solve the problem. regards Michael

yosempai 2016-05-04T21:50:00+00:00

Changing the priority of wpautop didn’t do the trick. However, I found this post on Stackoverflow that says You could also do $content = get_the_content(); echo apply_filters(‘the_content’, $content); which will pass the unfiltered content returned by get_the_content() through the default filter used on the_content() So for a quick hackish fix, I modified line 752 in faq-concertina.php to read: $content = get_the_content(); $faq_concertina .= wpautop( apply_filters('the_content', $content) ); And now my shortcodes work!

Michael Burridge 2016-05-06T17:49:00+00:00

Thanks for the info. I’ll test that out and possibly incorporate it into the code. Glad things worked for you in the end. regards Michael