Support » Plugins » WP Collapse-o-matic – call a funciton inside a shortcode??

  • Resolved discozo


    Hi there,

    I am trying to get product information inside a collapse-o-matic shortcode… I have put it into my template, and can get the expanding text to work:

    <?php echo do_shortcode('[expand title="More Information"]My content [/expand]'); ?>

    The only problem is that where it says ‘My Content’ above, I want to have this:

    <?php echo wpsc_the_product_additional_description(); ?>

    I just can’t seem to get the syntax right – can anybody help?

    Thanks so much in advance,

Viewing 1 replies (of 1 total)
  • If anyone else wants to try this, I worked out a solution – it’s a bit messy, but does the job, so long as you don’t want to use the Collapse-o-matic plugin anywhere else.

    I have hard coded the contents of the collapsable element, so that it’s always the product information.

    Go to plugins > jquery-collapse-o-matic > collapse-o-matic.php and find line 114, which looks like this:

    $eDiv = "<div id='target-".$id."' class='collapseomatic_content ".$targclass."'>".do_shortcode($content)."</div>\n";

    And edit .do_shortcode($content). to whatever you want. In my case:

    $eDiv = "<div id='target-".$id."' class='collapseomatic_content ".$targclass."'>".wpsc_the_product_additional_description()."</div>\n";

    I hope this helps someone!

Viewing 1 replies (of 1 total)
  • The topic ‘WP Collapse-o-matic – call a funciton inside a shortcode??’ is closed to new replies.