short code wont show posts
-
I am trying to get custom post types in my plugin and then show them
on a static page with the short code [forum]. The function works “inside” wordpress when im trying it in a template but not when im running it in my plugin file and then activating it with add_shortcode( ‘forum’, ‘fLoop’ ).What could be wrong here?
function fLoop(){ $mypost = array( 'post_type' => 'forum_custompost', ); $loop = new WP_Query( $mypost ); while ( $loop->have_posts() ) : $loop->the_post(); $output = '<div class="clear"></div><div class="childs grid_12">'; $output .= '<div class="entry-content"'. the_content().'</div>'; endwhile; $output .= '</div>'; return $output ; } add_shortcode( 'forum', 'fLoop' );
The topic ‘short code wont show posts’ is closed to new replies.