A
A
Andy-shak2015-11-04 13:34:55
WordPress
Andy-shak, 2015-11-04 13:34:55

How to display additional fields (meta box) on my single-"".php?

I created my own "Post Type" in the functions.php file, in the new "Post Type" I created an area with various add. fields ("text", "Picture", "Text area"). Everything in the new "record type" was displayed.
When publishing your "post type", the main content displays, and does not display additional content. fields on single-"...".php
How to display additional fields on the page on single-"...".php???
Or tell me where to dig :)
I use this code:

$card = new WP_Query( array( 'post_type' => 'card') );
if ( $card->have_posts() ) :
while ( $card->have_posts() ) : $card->the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php echo get_post_meta(post->ID(), 'id-моего доп. поля', true); ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2015-11-04
@wppanda5

This is trash and waste, it's strange that it doesn't swear
necessary
or
And here it is

$card = new WP_Query( array( 'post_type' => 'card') );

no, WordPress already knows that in the single-card.php template, it needs to pull the post_type card

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question