The result of a shortcode appear BEFORE page content

I have a page, with a shortcode that get all the post from a categorie and put after the content of the page. For no apparent reason, the result of a WP_Query() in the shortcode APPEAR ALWAYS at the top of the page. If i put the shortcode a the top OR at the bottom, the post (3 of them) appear before the content of the page…

on that one, i have NO IDEA why… shortcode is at the en of the page

Read More

after the comment i post the code the ECHO… this is the problem ?.. i to solve it ?

//Add a ShorCode to get a page/post content
add_shortcode ('post_cat2','get_post_cat2');
   function get_post_cat2 ($att) {

       $mypost = array();

       $args = array( 'category' => 36 );
       $myposts = get_posts( $args );

       foreach( $myposts as $post ) :   setup_postdata($post);
       $mypost .= the_title();
       endforeach;
       return $mypost;

   } 

Related posts

Leave a Reply

2 comments