WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP Collapse-o-matic - call a funciton inside a shortcode?? (2 posts)

  1. discozo
    Member
    Posted 2 years ago #

    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,
    Zo

  2. discozo
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic