1

I'm using a custom post type and use this plugin to display my custom post type's archives, does anyone knows how to display my custom post type's name/title to the archive.php?

Below is the archive.php

<?php
/**
 * The template for displaying all single posts and attachments
 *
 * @package WordPress
 * @subpackage Twenty_Fifteen
 * @since Twenty Fifteen 1.0
 */

get_header(); ?>
 <!-- **Main - Starts** --> 
<div id="main">
    <div class="parallax full-width-bg" style="background: #ffffff;">
        <div class="container">
            <div class="main-title">
                <h1><?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?></h1>
                <p style="color:#dddddd;font-size:13px;font-style:italic;margin: 5px 0px 0px 0px;"><?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?></p>
             </div>
        </div>
    </div>  
    <div class="container">
        <!-- Primary Starts -->
        <?php if ( have_posts() ) : ?>
        <section id="primary" class="with-right-sidebar page-with-sidebar">
            <div class="dt-sc-margin30"></div>
             <?php while ( have_posts() ) : the_post();
                get_template_part( 'content-archive', get_post_format() );
            endwhile;?>
            <div class="dt-sc-margin80"></div>
            <div class="dt-sc-margin80"></div>
        </section> <!-- **Primary - Ends** -->
        <?php get_sidebar(); ?>
        <?php else :
            get_template_part( 'content', 'none' );
        endif; ?>  
    </div>
</div>
<?php 
wp_footer();
get_footer();
?>

1 Answer 1

1

You can use post_type_archive_title( $prefix = '', $display = true ):

<h1><?php post_type_archive_title() ?></h1>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.