First, I am using default theme twentyseventeen. I've used plugin Custom Post Type UI to create a new post type called film_kernal
For that post type I have created some custom fields, one of which is called Quality Score
I followed a tutorial that had me display this as an archive which is working. The custom posts I have created a displayed on an archive page in a list however they do not display my custom field either on this archive page, or when I actually click on the post and visit an individual page.
I would like to display a custom field on my archive page, I have created a new child theme layout called archive-film_kernal.php
however I am unsure how to modify the code to add in the field 'Quality Score'.
The template code is a copy of the original archive.php
and is below. From reading I think I need to use get_post_meta() but I'm not sure how to use this properly, or how to select only one, or several of my custom fields rather than all.
Thanks in advance.
<?php /*Template Name: Custom Archive Layout Test */?>
<?php
get_header(); ?>
<div class="wrap">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php endif; ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) :
?>
<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
]
get_template_part( 'template-parts/post/content', get_post_format() );
endwhile;
the_posts_pagination(
array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
)
);
else :
get_template_part( 'template-parts/post/content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php
get_footer();