Trouble displaying post using shortcode
-
I’m trying to write a plugin, not rocket science: just prints out the contents of a post:
function my_post_function($atts) { $post_object = get_post($atts['post']); return $post_object->post_content); } add_shortcode('mypostdisplay', 'my_post_function');
No this work ‘almost’ OK ??
If I use something like:[mypostdisplay post=45]
Then this displays the post
BUT there is no formatting at all AND there are no carriage returns ??If I display in the middle of small text, then the output is also small text – whereas I just want it to be how it would normally show if I were displaying the post on its own
Where am I going wrong?
ALSO, I’ve tried the following:
'<p>'.format_to_post($post_object->post_content).'</p>'
I saw this being done in another plugin – but this seems to have no effect ??Thanks
Omar
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Trouble displaying post using shortcode’ is closed to new replies.