Skip to content

Custom Post Type Singular Template File

Important: Before you go adding custom files or code to your site to customize your post type, be aware that you can make use of our Post Types Unlimited plugin for adding your custom post types which gives you all the options you need to fully customize your custom post type and you can even create a Dynamic Template via the page builder to customize your post type design.

Total supports any new custom post type you throw at it with a basic design (similar to that of blog posts). Depending what you want/need exactly you may not have to copy ANY file over to a child theme if you want to customize the look of your custom post type posts. If you want to show/hide sections on the entries and posts you can do so via functions in your child theme instead which is more efficient and less messy:

However, if you want 100% control you can always just make a new single-{post_type}.php file with the exact code you want for your custom post type posts. Because Total uses various template parts it’s best to not copy the singular.php file and duplicate it for your custom post type. It’s best to start with a more basic standard template file. Below is the code for a basic template file you can use as a starting point (simply create your single-{post_type}.php file in your child theme and add this code).

<?php
get_header(); ?>

	<div id="content-wrap" class="container wpex-clr">

		<?php wpex_hook_primary_before(); ?>

		<div id="primary" class="content-area wpex-clr">

			<?php wpex_hook_content_before(); ?>

			<div id="content" class="site-content wpex-clr">

				<?php wpex_hook_content_top(); ?>

				<?php
				// Display singular content unless there is a custom template defined
				if ( ! function_exists( 'wpex_theme_do_location' ) || ! wpex_theme_do_location( 'single' ) ) :

					// Start loop
					while ( have_posts() ) : the_post(); ?>

						YOUR CONTENT HERE

					<?php endwhile; ?>

				<?php endif; ?>

				<?php wpex_hook_content_bottom(); ?>

			</div>

			<?php wpex_hook_content_after(); ?>

		</div>

		<?php wpex_hook_primary_after(); ?>

	</div>

<?php
get_footer();
Back To Top