Shortcode printing the_content outside of html code
-
I am working on creating a shortcode, but my code is printing the_content outside of the div I am telling it to in my functions file.
function get_event_container() { global $post; $ret = '<section class="event_container clearfix">'; $ret = $ret . get_event_details(false, true); $ret = $ret . '<div class="right-column-long">' . the_content($post->ID) . '</div>'; $ret = $ret . '</section>'; return $ret; } function get_event_details() { global $post; $unixtime = get_post_meta($post->ID, 'event_date', true); $ret = '<div class="left-image">'; $ret = $ret . '<h3>' . $post->post_title . '</h3>'; $ret = $ret . '<p><h4>'.get_post_meta($post->ID, 'event_location', true) . '</h4>'; $ret = $ret . '</p><p>'; $ret = $ret . date("F d, Y", $unixtime) . '<br/>'; $ret = $ret . '<em>' . get_post_meta($post->ID, 'event_start_time', true) . ' - '; $ret = $ret . get_post_meta($post->ID, 'event_end_time', true) . '</em>'; $ret = $ret . '</div>'; return $ret; }
It is printing the following markup:
<section class=”event_container clearfix”><div class=”left-image”><h3>test</h3><p><h4></h4></p><p>October 13, 201211:30 am – 1:30 pm</div><div class=”right-column-long”></div></section><p>Testing description area</p>
So here the_content is printing after the end div and section tag, any ideas why? Confused…
Is there a posiblity it’s because the loop in my actual page is calling the_content(); also, if so how should I reference these differently?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Shortcode printing the_content outside of html code’ is closed to new replies.