WordPress.org

Ready to get started?Download WordPress

Forums

Creating a front-page.php template (3 posts)

  1. RagDolls
    Member
    Posted 1 year ago #

    I am using the theme Grisaille. My front, static page has a side bar with blog post archives etc. I want to get rid of this side bar on this page only. I already
    1. created a child theme, and installed it
    2. was told to create a front-page.php template, deleting the sidebar, than add css to change the width of the main content.
    I have been digging everywhere on wordpress as well as any site that has info and am confused to say the least.

    What I understand is that I make a file with my text editor, call it front-page.php
    I put this code in it-
    <?php
    /*
    Template Name: front-page
    */
    ?>
    At this point I download it to the child theme folder on my server. Now what?
    Do I copy the entire page I want to alter and paste it in the above file, and what page do I copy page.php or home.php? I would really appreciate some advice, since I feel I've made some progress but it doesn't matter if the whole process isn't done.
    thank you, Diane

  2. Hi Diane,

    Go and grab the entire content of page.php and paste it into your front-page.php.
    You actually don't even need the php comment in there. Custom Templates need it, but not the front-page.php

    Once you have the code in, remove the mention of the_sidebar();
    and then save the front-page.php in your child theme.

    Upload that file in your child theme directory and because it has the name front-page.php it will automatically be used to display your front page.

    Good luck.

  3. RagDolls
    Member
    Posted 1 year ago #

    Hi Christine,
    I'm getting there, but hit a road block since the page.php template for my theme Grisaille has no mention of sidebar... am I missing something? Here's the copy-

    /**
    *@desc A page. See single.php is for a blog post layout.
    */

    get_header();

    if (have_posts()) : while (have_posts()) : the_post();
    ?>

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <h1 class="postTitle">" rel="bookmark"><?php the_title(); ?></h1>
    <?php if ( comments_open() || have_comments() ) {?>
    <span class="comments"><?php comments_popup_link('0', '1 ', '%'); ?></span>
    <?php }?>
    <div class="clearfix page-title-border-bottom"></div>

    <div class="post-wrap"><?php the_content(); ?></div>
    <?php wp_link_pages(
    array( 'before' => '<p class="pages-links">' . __('Pages:','grisaille'),
    'after' => '</p>',
    'next_or_number' => 'number',
    'nextpagelink' => __('Next page','grisaille'),
    'previouspagelink' => __('Previous page','grisaille'),
    'pagelink' => '%')); ?>
    <p class="postMeta"><?php edit_post_link(__('Edit', 'grisaille'), ''); ?></p>
    </div>

    <?php
    if ( comments_open() || have_comments() ) {
    comments_template();
    }
    ?>

    <?php

    endwhile; else: ?>

    <p>Sorry, no pages matched your criteria.</p>

    <?php
    endif;

    get_footer();
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic