0

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): https://thoughtversation.com/

And here is my single.php code:

    <?php
    /*
    ** Template Name: Full-width
    */
    get_header(); ?>
    <div id="loop-container" class="loop-container">
        <?php
        if ( have_posts() ) :
            while ( have_posts() ) :
                the_post(); ?>
                <div <?php post_class(); ?>>
                    <article>
                        <?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>
                            <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>
                        </div>
                    </article>
                    <div class="comments-container">
                        <?php comments_template(); ?>
                    </div>
                </div>
            <?php endwhile;
        endif; ?>
    </div>
    <?php get_footer();

Thanks in advance for the help!

1

1 Answer 1

0

No custom template is necessary.

Copy sidebar-primary.php to your child theme. Change first line to:

if ( is_page_template( 'templates/full-width.php' ) || is_single() ) {

Go to Customize -> Additional CSS, and add:

.single-post #main {
  width: 100%;
  float: none;
} 

Done.

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.