Title: Custom Post Issue
Last modified: August 19, 2016

---

# Custom Post Issue

 *  [welshhuw](https://wordpress.org/support/users/welshhuw/)
 * (@welshhuw)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-issue/)
 * Hi,
 * I cannot get my custom posts to show for some reason, Can some one please help!
 * Here is my functions.php code:
 *     ```
       //Custom Post Types
       add_action('init', 'product_register');
   
               function product_register() {
               $args = array(
                       'label' => __('For Sale'),
                       'singular_label' => __('forsale'),
                       'public' => true,
                       'show_ui' => true,
                       'capability_type' => 'post',
                       'hierarchical' => false,
                       'rewrite' => true,
                               'menu_icon' => 'http://example.com/images/for-sale-icon.png',
                       'supports' => array('title', 'editor')
               );
   
               register_post_type( 'forsale' , $args );
               }
       ```
   
 * Here is my custom template file:
 *     ```
       <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
   
                               <h2><?php the_title(); ?></h2>
   
                               <div id="fb"><a href="http://www.facebook.com/pages/pontlottyn-mid-glamorgan/South-Wales-Customs/139115299461925"><img alt="South Wales Customs Facebook Page" src="<?php bloginfo('template_directory'); ?>/images/fb.png" /></a></div>
   
                               <h3><?php the_title(); ?></h3>
                               <?php the_content(); ?>
   
                               <?php $loop = new WP_Query( array( 'post_type' => 'forsale', 'posts_per_page' => 100 ) ); ?>
                                       <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                                               <?php endwhile; ?>
   
                               <div class="clear"></div>
                               <p><a href="contactus.html"><img alt="South Wales Motorcycle Mot Centre" src="<?php bloginfo('template_directory'); ?>/images/mot-banner.png" /></a></p>
   
                       </div><!--content-->
   
       <?php endwhile; ?>
       ```
   
 * Please can someone help!!

Viewing 1 replies (of 1 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-issue/#post-1716778)
 * At the least, after this line:
 *     ```
       <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
       ```
   
 * you would need to display the necessary info such as:
 *     ```
       echo $loop->post->post_title;
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Custom Post Issue’ is closed to new replies.

## Tags

 * [custom posts](https://wordpress.org/support/topic-tag/custom-posts/)

 * 1 reply
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-issue/#post-1716778)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
