Support » Themes and Templates » Why page templates change page layout?

  • Web:
    I only need Comments page to show Leave a Reply.
    So I copied the whole code from sidebar-page.php to make a new page template (for Comments page), deleted <?php comments_template( ”, true ); ?> in sidebar-page.php (for the rest pages)

    The layout was changed on Comments page and different to other pages. The content area occupied all pages and moved sidebar area under it. I can’t work out why it happened, I have set #content {width 60%;} but why a new page template changed the page layout?

    Thank you for reading.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It changed #primary and #content, can anyone explain it please?

    By the way, I managed to use is_page as conditional tag to show “Leave a Reply” for a certain page, but it stated “Cannot Be Used Inside The Loop”. I coded as the below, it’s inside the loop, may any problems?

    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'content', 'page' ); ?>
    <?php if(is_page('menu')) comments_template( '', true ); ?>
    <?php endwhile; // end of the loop. ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Why page templates change page layout?’ is closed to new replies.