WordPress.org

Ready to get started?Download WordPress

Forums

Collapse-O-Matic
[resolved] Pass function thru shortcode (4 posts)

  1. presquillian
    Member
    Posted 1 year ago #

    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/

  2. presquillian
    Member
    Posted 1 year ago #

    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>
  3. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    Thumbs up for figuring it out!

  4. UaMV
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic