Support » Theme: Period » Remove Excerpt from one Custom Post Type

  • OK, I’ve almost got my excerpts squared away on my site now, but I’ve run into one last issue that I can’t seem to resolve.

    Is there an easy way that I can exclude one Custom Post Type from showing excerpts on the Archive listing? I want the excerpts on all the other archive pages, but I want the full post to display for this one CPT.

    Thanks for any suggestions you might have.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Subrata Sarkar


    I am not sure if this will help you, but you can always check post_type value of a post object. If the value of post_type is same where you want to show the full content display the_content() otherwise keep displaying the_excerpt();

    For example if you are inside a loop:

    if( $query->have_posts() ) {
      while( $query->have_posts() ) : $query->the_post();
        $post_type = $post->post_type; //global $post object
        if( 'your_post_type' == $post_type ) {
        } else {
    Theme Author Ben Sibley


    I’m afraid there isn’t any kind of setting in Period for this. Do you have a “child theme” installed for your site? I can provide some PHP to help make this change.

    OK, so I managed to do this by creating a new archive page for the Custom Post Type (CPT) named ‘archive-micropost.php’ and it seems to be working well. ‘micropost’ is the name of the CPT.

    Now I am just trying to create a slightly different single post page for the same CPT and have created a ‘single-micropost.php’ file for the theme, which is almost working correctly, except that the content of the post is not showing up.

    Here’s what I’ve got:

    <?php get_header(); ?>
    <div <?php post_class(); ?>>
    		<?php do_action( 'post_before' ); ?>
    		<?php ct_period_featured_image(); ?>
    		<div class="post-container">
    			<div class='post-header'>
    				<h1 class='post-title'><?php the_title(); ?></h1>
    				<?php get_template_part( 'content/post-byline-micropost' ); ?>
    			<div class="post-content">
    				<?php the_content(); ?>
    				<?php wp_link_pages( array(
    					'before' => '<p class="singular-pagination">' . __( 'Pages:', 'period' ),
    					'after'  => '</p>',
    				) ); ?>
    				<?php do_action( 'post_after' ); ?>
    			<div class="post-meta">
    				<?php get_template_part( 'content/post-categories' ); ?>
    				<?php get_template_part( 'content/post-tags' ); ?>
    				<?php get_template_part( 'content/post-nav' ); ?>
    	<div class="comments-container">
    		<?php comments_template(); ?>
    the_posts_pagination( array(
        'prev_text' => __( 'Previous', 'period' ),
        'next_text' => __( 'Next', 'period' )
    ) );

    Any ideas?


    Theme Author Ben Sibley


    Okay great. I would recommend creating a new file named “content-micropost.php’ and copying everything from content.php into that file. Then content-micropost.php will be loaded for your CPT pages and include all of the regular post content. From there, you can customize the file to differentiate it from the regular post format.

    Wow, that was so simple! Thanks a lot, it’s working great now!

    Theme Author Ben Sibley


    Great! Happy to help ๐Ÿ™‚

    OK, so this was working great until the update for the theme that just came up. I have copied the content-micropost.php file back into the proper directory and it’s no longer working.

    Any ideas what may have broken?

    Theme Author Ben Sibley


    Did you have the files in a child theme? If not, they will need to be added back into Period again.

    Like I said, I copied the file back again and itโ€™s still not working.

    Theme Author Ben Sibley


    There were not any changes in the recent update for Period that affect CPT compatibility. You can review the changelog on Github here to verify:

    Since any custom files would be removed when the theme is updated, that would definitely cause a problem. There were content-micropost.php and archive-micropost.php files discussed so I want to make sure they’ve both definitely been uploaded to the “period” folder on the server again.

    I’m not sure why they would stop working otherwise, but I would recommend placing both files into a child theme instead and activating that. This will create the same outcome for your site but the files won’t be removed when updating Period. You can download a starter child theme here and use the Customizer Export/Import plugin to copy over Customizer settings.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.