WordPress.org

Support

Support » Plugins and Hacks » Collapse-O-Matic » [Resolved] Pass function thru shortcode

[Resolved] Pass function thru shortcode

  • I love this plugin! I’m just having a bit of trouble accomplishing one thing. How may I accomplish something like the following:

    <?php
    echo do_shortcode('[expand title="Title" expanded="true" tag="div" trigpos="below" swaptitle="Off"]<?php
    $post_id = 454;
    $queried_post = get_post($post_id);
    ?>
    <h2><?php echo $queried_post->post_title; ?></h2>
    <?php echo $queried_post->post_content; ?>[/expand]');?>

    I’m trying to pass a function to grab post content- out side of a post or page. I can’t seem to get the post content to work. Is there a better way to accomplish this? Thanks so much for your help!

    Also- I’m trying to use an image as the title- similar to this example
    [expand title=”<img src=’falcon_girl.jpg’ />” tag=”div”]Target Content[/expand]
    when I try this outside a post or page and using a full URL – no image appears

    <?php
    echo do_shortcode('[expand title="<img src="http://site.com/content/uploads/11/image.jpg" expanded="true" tag="div" trigpos="below" swaptitle="Off"]...[/expand]');?>

    Thanks again. Keep up the great work!

    http://wordpress.org/extend/plugins/jquery-collapse-o-matic/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Never mind! I’m all set.

    <div id="target-test" class="collapseomatic_content">
    <?php
    $post_id = 454;
    $queried_post = get_post($post_id);
    echo $title;
    echo $queried_post->post_content;
    ?>
    </div>
    <span title="Results" class="collapseomatic" id="test"><img src="http://site.com/content/uploads/2012/11/Untitled-1.png"></span>
    <span id="swap-test" class="collapseomatic" style="display: none;">Close</span>

    Plugin Author Baden

    @baden03

    Thumbs up for figuring it out!

    @presquillian: You might find this plugin of use, as well … Collapse-O-Collection. i’ve just recently been working on it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Pass function thru shortcode’ is closed to new replies.
Skip to toolbar