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/
The topic ‘Pass function thru shortcode’ is closed to new replies.