Custom post type & templates

Quick question- I am using X Pro and have created a new custom post type called ‘Inventory’. When editing a page, I am unable to set the page template to ‘No Container | Header, Footer’?

Here is what I have tried so far:

1.Created a ‘single-inventory.php’ file that I placed in my pro-child theme folder. The code was as follow:
<?php

// =============================================================================
    // SINGLE.PHP
    // -----------------------------------------------------------------------------
    // Handles output of individual inventory.
    //
    // Content is output based on which Stack has been selected in the Customizer.
    // To view and/or edit the markup of your Stack's posts, first go to "views"
    // inside the "framework" subdirectory. Once inside, find your Stack's folder
    // and look for a file called "wp-single.php," where you'll be able to find the
    // appropriate output.
    // =============================================================================

    ?>

    <?php x_get_view( x_get_stack(), 'wp', 'single-inventory' ); ?>
  1. Created ‘wp-single-inventory.php’ file in pro-child > frameworks > views > integrity folder (being that I use integrity stack.

    <?php

    // =============================================================================
    // VIEWS/INTEGRITY/WP-SINGLE.PHP
    // -----------------------------------------------------------------------------
    // Single post output for Integrity.
    // =============================================================================

    $fullwidth = get_post_meta( get_the_ID(), ‘_x_post_layout’, true );

    ?>

    <?php get_header(); ?>
       <?php while ( have_posts() ) : the_post(); ?>
         <?php x_get_view( 'integrity', 'content', get_post_format() ); ?>
         <?php x_get_view( 'global', '_comments-template' ); ?>
       <?php endwhile; ?>
    
     </div>
    
     <?php if ( $fullwidth != 'on' ) : ?>
       <?php get_sidebar(); ?>
     <?php endif; ?>
    
    <?php get_footer(); ?>
  2. Created ‘content-inventory.php’ file in pro-child > frameworks > views > integrity folder (being that I use integrity stack.

    <?php

    // =============================================================================
    // VIEWS/INTEGRITY/CONTENT.PHP
    // -----------------------------------------------------------------------------
    // Standard post output for Integrity.
    // =============================================================================

    ?>

    >
    <?php x_featured_image(); ?>
    <?php x_get_view( 'integrity', '_content', 'post-header' ); ?> <?php x_get_view( 'global', '_content' ); ?>
    <?php x_get_view( 'integrity', '_content', 'post-footer' ); ?>
  3. However, that did not work. Any help or suggestions would be greatly appreciated. Thank you in advance.

Hello There,

Templates works differently for post or custom post type. See this: https://developer.wordpress.org/themes/basics/template-hierarchy/

An option to choose template is only available for pages. For regular post or custom post type the template is already set. What we build on the template is what we will see. If you want your custom post type to have no container, look for the wp-single-inventory.php file.

From the start of the file below this line: <?php get_header(); ?> we can see the following line :
<div class="x-container max width offset">. Remove max width from that line and your custom post type content will now be fullwidth. Those class sets the container WIDTH AND MAX_WIDTH.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.