mycred_sell_this with do_shortcode not working

front page Forums Community mycred_sell_this with do_shortcode not working

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #6195

    Hi im trying to use mycred_sell_this in a custom page template with do_shortcode but the include is visible always.

    <?php echo do_shortcode('[mycred_sell_this price="5"]'); ?> <? include 'accion.php'; ?><?php echo do_shortcode('[/mycred_sell_this]'); ?>




    I think the issue here is that you are breaking up the shortcode into two by calling the do_shortcode twice. The first time you call it, you have no content defined so the shortcode will close itself. The second time you use it, will return nothing since the shortcode with just a closing tag is not valid.

    If you need to load a php file, you might want to buffer the output from your php file and insert it into the shortcode:

    include 'accion.php';
    $content = ob_get_contents();
    echo do_shortcode( '[mycred_sell_this price="5"]' . $content . '[/mycred_sell_this]' );

    It really depends on whats inside this custom php file you are including. In the above example, the files content are stored under the $content variable which is inserted into the shortcode.

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

You must be logged in to reply to this topic.