How do I change the template specifically for single posts?


My goal is that when someone clicks on a post, the page they are taken to has no sidebar cluttering the view. I want them to focus on the content. I only want the sidebar to appear on the homepage, which in my specific case is the page where all posts are loaded in order. All static pages on the site have customization options in WordPress’ page editor, so my only issue is the page that appears after you click “Continue Reading”

I’m using WordPress’ “Period” theme as the parent, and editing in a child theme. The template I want to apply to all single posts is Period’s “Full-Width” template. There is no single.php file in the Period theme, so I created one in my child theme. I already tried duplicating the template into my single.php file, but that didn’t change anything.

Does anyone have any suggestions? Here is my website (it’s definitely not finished yet):

And here is my single.php code:

    ** Template Name: Full-width
    get_header(); ?>
    <div id="loop-container" class="loop-container">
        if ( have_posts() ) :
            while ( have_posts() ) :
                the_post(); ?>
                <div <?php post_class(); ?>>
                        <?php do_action( 'page_before' ); ?>
                        <?php ct_period_featured_image(); ?>
                        <div class="post-container">
                            <div class="post-header">
                                <h1 class="post-title"><?php the_title(); ?></h1>
                            <div class="post-content">
                                <?php the_content(); ?>
                                <?php wp_link_pages( array(
                                    'before' => '<p class="singular-pagination">' . esc_html__( 'Pages:', 'period' ),
                                    'after'  => '</p>',
                                ) ); ?>
                                <?php do_action( 'page_after' ); ?>
                    <div class="comments-container">
                        <?php comments_template(); ?>
            <?php endwhile;
        endif; ?>
    <?php get_footer();

Thanks in advance for the help!

Jonathan Wilson 2 years 2021-04-26T15:46:51-05:00 0 Answers 0 views 0

Leave an answer