Title: short code wont show posts
Last modified: August 22, 2016

---

# short code wont show posts

 *  [emmaandand](https://wordpress.org/support/users/emmaandand/)
 * (@emmaandand)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/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.

 * 0 replies
 * 1 participant
 * Last reply from: [emmaandand](https://wordpress.org/support/users/emmaandand/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/short-code-wont-show-posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
