A
A
Andy-shak2015-11-03 13:29:10
WordPress
Andy-shak, 2015-11-03 13:29:10

How to display custom post type and custom fields on my page?

I created my own "record type", added my own custom fields. How to display the entire post with performance fields on your page without using "single.php". Need code on how to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mr Crabbz, 2015-11-03
@Punkie

So create single-posttype.php where posttype is your post type. And in it already display the fields as you like.

A
Andy-shak, 2015-11-03
@Andy-shak

Created single-"my post type".php. I am writing this code.

<?php	
      $card = new WP_Query( array( 'post_type' => 'card') );
        if ( $card->have_posts() ) :
        while ( $card->have_posts() ) : $card->the_post(); ?>
    <div class="card">
        <h2><?php the_title(); ?></h2>
        <p><? the_content(); ?></p>
    </div>
      <?php endwhile; ?>
      <?php endif; ?>

After the publication of the record, writes "page not found", the record is not displayed, the main page is being displayed. What could be causing this problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question