• Resolved reza2511

    (@reza2511)


    Hi everybody,

    I am using a template which doesn’t accept the shortcode of [wpsm_comparison_table id=”1″]
    Actually, this template has a problem with spacing in the shortcodes. For example the space between _table and id=1. Once I put the mentioned shortcode like <?php echo do_shortcode("[wpsm_comparison_table id="1" class=""]"); ?> in the template, I cannot load the website.
    Please kindly help me with this issue.

    Regards,

    • This topic was modified 7 years, 6 months ago by reza2511.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You’re mixing up quotes in a way that isn’t valid PHP. If you write do_shortcode() like this:

    do_shortcode( "" );
    

    Then whatever is inside the quotes, "", will be parsed for shortcodes. But if you write the shortcode like this:

    [wpsm_comparison_table id="1" class=""]
    

    Then the first " will close the quotes inside do_shortcode(), breaking the code.

    You need to use different quotes for each part. Use single quotes for the do_shortcode() function, and double quotes for the shortcode:

    do_shortcode( '[wpsm_comparison_table id="1" class=""]' );
    

    See the article on Strings in the PHP Manual for more information.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What do you mean by:

    I am using a template which doesn’t accept the shortcode

    What theme is it?

    ps. I recommend moving away from a theme that uses shortcodes because that will make it a little harder to switch themes down the road.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem of shortcode in theme’ is closed to new replies.