Title: Post type problem
Last modified: August 20, 2016

---

# Post type problem

 *  [TataVostru](https://wordpress.org/support/users/tatavostru/)
 * (@tatavostru)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/)
 * How can i display in custom post_type page the post.
 * For example :
 * Post’s : Movies
    Post_type : Box-Office
 * I use custom field. In box office post’s i ad the movies for Box-Office.
 * How can i display the title, image, and other custom field that are atached to
   post’s

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Paul Kaiser](https://wordpress.org/support/users/freakingid/)
 * (@freakingid)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/#post-2899622)
 * To display the value of custom fields, use get_post_meta():
    [http://codex.wordpress.org/Function_Reference/get_post_meta](http://codex.wordpress.org/Function_Reference/get_post_meta)
 * Is that what you’re looking for?
 * Cheers,
    Paul
 *  Thread Starter [TataVostru](https://wordpress.org/support/users/tatavostru/)
 * (@tatavostru)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/#post-2899624)
 * Hy im not familiar so good with php code,i’m building a cinema site, im stuck
   in Box-office
 * EX: [http://cinema.trancelevel.com/box-office/1-iulie-7-iulie-2012/](http://cinema.trancelevel.com/box-office/1-iulie-7-iulie-2012/)
 * The Movies are stored in Posts :
    [http://www.cinema.trancelevel.com/movies.jpg](http://www.cinema.trancelevel.com/movies.jpg)
 * The Box-office are post_type:
    [http://www.cinema.trancelevel.com/box.jpg](http://www.cinema.trancelevel.com/box.jpg)
 * How can i link to display the post into post type…?
 *     ```
       <?php
       //create new loop query for films by this actor
       $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'distributie' AND meta_value LIKE '%".get_the_ID()."%'");
       $the_query = new WP_Query( array( 'post__in' => $movies) );
   
       // The Loop
       while ( $the_query->have_posts() ) : $the_query->the_post();
       	echo '<div class="actor-box-related"><a class="actor-titlu" href="';
       	the_permalink();
       	echo '" title="'.get_the_title().'">';
       	?>
           <img class="actor-img" src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=90&w=60&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>
   
           <?php the_title();
       	echo '</a></div>';
       endwhile;
   
       // Reset Post Data
       wp_reset_postdata();
       ?>
       ```
   
 *  Thread Starter [TataVostru](https://wordpress.org/support/users/tatavostru/)
 * (@tatavostru)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/#post-2899628)
 * meta_key = ‘distributie’ – is for display-ng the movies from post( that are stored)
   in actors page.
 * Ex: the movie that actor play in.
 * —————-
 * Now in Box-Office i have post_type with the field locul_1, locul_2… and so on
 * In each other i add a movie that i want to be display in Box Office Theme
 * Theme :
 *     ```
       <?php
       /*
       Template Name Posts: Pagina Box-Office RO
       */
       ?>
       <?php include (TEMPLATEPATH . '/header/index-trailer.php'); ?>
       <div class="art-contentLayout">
       <div class="breadcrumbs">
           <?php if(function_exists('bcn_display'))
           {
               bcn_display();
           }?>
       </div>
   
       <div class="art-content">
   
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       <div class="box-film">
       <h2 class="titlu-film">
       <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('%s'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a>
       </h2>
   
       <div class="art-Post">
           <div class="art-Post-tl"></div>
           <div class="art-Post-tr"></div>
           <div class="art-Post-bl"></div>
           <div class="art-Post-br"></div>
           <div class="art-Post-tc"></div>
           <div class="art-Post-bc"></div>
           <div class="art-Post-cl"></div>
           <div class="art-Post-cr"></div>
           <div class="art-Post-cc"></div>
           <div class="art-Post-body">
   
       <table class="tabel-box" border="0" cellpadding="1">
         <tr>
           <td class="tabel-img" rowspan="3"><img src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=120&w=90&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>
       </td>
           <td class="tabel-numar">1</td>
           <td class="tabel-titlu" colspan="5"></td>
         </tr>
         <tr>
           <td  class="tabel-numar-s"rowspan="2"></td>
           <td class="tabel-gen">Gen film</td>
           <td class="tabel-st">Saptamana trecuta</td>
           <td class="tabel-iw">Incasari Weekend</td>
           <td class="tabel-t">Vezi trailer</td>
         </tr>
         <tr>
           <td class="tabel-link">Action, adventure</td>
           <td class="tabel-link"><?php $key="incasari_weekend"; echo get_post_meta($post->ID, $key, true); ?></td>
           <td class="tabel-link"><?php $key="incasari_totale"; echo get_post_meta($post->ID, $key, true); ?></td>
           <td class="tabel-link">&nbsp;</td>
         </tr>
         </table>
   
       </div>
       </div>
   
       </div>
   
       <?php endwhile; ?>
       <?php else: ?>
       <h2 class="center"><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></h2>
       <?php endif; ?>
   
       </div>
       <?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
       </div>
       <div class="cleared"></div>
   
       <?php get_footer(); ?>
       ```
   
 *  Thread Starter [TataVostru](https://wordpress.org/support/users/tatavostru/)
 * (@tatavostru)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/#post-2899632)
 * this is geting me the id for the movie , now how can i get the link
 *     ```
       <?php
       $locul_1_value = get_post_meta($post->ID, 'locul_1', true);
       // check if the custum field has a value
       if($locul_1_value != '') {
         echo $locul_1_value;
       }
       ?>
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Post type problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [TataVostru](https://wordpress.org/support/users/tatavostru/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/post-type-problem/#post-2899632)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
