WordPress.org

Forums

Why page templates change page layout? (3 posts)

  1. designpromote
    Member
    Posted 2 years ago #

    Web: http://www.kampungali.com
    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.

  2. designpromote
    Member
    Posted 2 years ago #

    It changed #primary and #content, can anyone explain it please?

  3. designpromote
    Member
    Posted 2 years ago #

    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. ?>

Topic Closed

This topic has been closed to new replies.

About this Topic