• Resolved yosempai

    (@yosempai)


    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://www.ads-software.com/plugins/faq-concertina/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Michael Burridge

    (@mburridge)

    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

    Thread Starter yosempai

    (@yosempai)

    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:
    https://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.

    Plugin Author Michael Burridge

    (@mburridge)

    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:

    https://customcreative.co.uk/resolving-wpautop-and-shortcodes/

    I hope this helps you to solve the problem.

    regards
    Michael

    Thread Starter yosempai

    (@yosempai)

    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!

    Plugin Author Michael Burridge

    (@mburridge)

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shortcodes not executing in FAQ post’ is closed to new replies.