WordPress.org

Ready to get started?Download WordPress

Forums

Remove widgets on designated posts page (14 posts)

  1. mstanford
    Member
    Posted 3 years ago #

    http://www.lukesevern.com / using Graphene theme.

    1) I created a new page called "blog" and made it a one-column template page so widgets would not show up.

    2) Then I went into my Reading section and make the blog page the default posts page, so I could have a static home page.

    3) Widgets still showing up on the blog page. How do I get rid of them?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Have you published and set up a static front page yet?

  3. mstanford
    Member
    Posted 3 years ago #

    Yes I have you can check it out: http://www.lukesevern.com

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Your Blog page will be using index.php as its template file - so that's the file that you need to edit.

  5. mstanford
    Member
    Posted 3 years ago #

    Forgive me, I am just starting to learn php. My index.php file is very simple. This a kind of a shot in the dark, but would this work?

    <?php
    if (is_page("Blog")))
    {
    include (TEMPLATEPATH . "/template-onecolumn.php");
    }
    endif;
    ?>

    I am confused because I set my homepage to be Home, not Blog. You're saying the blog still pulls from the index template?

    Thanks for being patient, as I said I am just learning.

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    You're saying the blog still pulls from the index template?

    Yes - as soon as you designate it as the main Posts page.

    <?php
    include (TEMPLATEPATH . "/template-onecolumn.php");
    ?>

    would be all that you need if you want to approach it that way.

  7. mstanford
    Member
    Posted 3 years ago #

    I put that snippet in the index.php file, but unfortunately it didn't seem to work. I don't want to remove the widgets from other pages that rely on the index template, like 'About.' When I applied that code it made everything go wonky and made the footer disappear.

  8. esmi
    Forum Moderator
    Posted 3 years ago #

    The About page doesn't use index.php. It uses page.php

  9. mstanford
    Member
    Posted 3 years ago #

    Weird, I can't see page.php in my editor. When I edited the code for index.php it definitely affected the about page's sidebar. Any ideas for why that might be? Thank you so very much for all your help!

  10. esmi
    Forum Moderator
    Posted 3 years ago #

    It's possible that you could have a very simple theme that uses index.php for almost every page instead of individual templates. If that is the case, then something like:

    <?php if( is_home() ) include (TEMPLATEPATH . "/template-onecolumn.php");
    ?>

    in the relevant place in your index.php file should limit your 1 column template to just your main posts page.

  11. mstanford
    Member
    Posted 3 years ago #

    For some reason that code just duplicated the post!

    Even though I specified that the Blog page should be the one-col template, does this code override that designation? It must be the fact that it is designated as the Posts page. What file would control that override?

    Here is my index.php code:

    <?php
    /**
    * The main template file.
    *
    * This is the most generic template file in a WordPress theme
    * and one of the two required files for a theme (the other being style.css).
    * It is used to display a page when nothing more specific matches a query.
    * E.g., it puts together the home page when no home.php file exists.
    * Learn more: http://codex.wordpress.org/Template_Hierarchy
    *
    * @package WordPress
    * @subpackage Graphene
    * @since Graphene 1.0
    */

    get_header(); ?>

    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-index.php and that will be used instead.
    */
    get_template_part('loop', 'index');
    ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    ___________
    Here is the code for the one-col template:

    <?php
    /**
    * Template Name: One column, no sidebar
    *
    * A custom page template without sidebar.
    *
    * @package WordPress
    * @subpackage Graphene
    * @since Graphene 1.0.5
    */
    get_header(); ?>

    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-single.php and that will be used instead.
    */
    get_template_part('loop', 'single');
    ?>

    <?php get_footer(); ?>

  12. esmi
    Forum Moderator
    Posted 3 years ago #

    Try creating a file called loop-index.php that simply contains:

    <?php
    include (TEMPLATEPATH . "/template-onecolumn.php");
  13. mstanford
    Member
    Posted 3 years ago #

    Created the file and uploaded to theme folder. Entered <?php
    include (TEMPLATEPATH . "/template-onecolumn.php");?>

    Result: http://lukesevern.com/photography/blog-2/

    Same effect as putting that snippet into the index.php file

  14. esmi
    Forum Moderator
    Posted 3 years ago #

    I can only see a single post on your home page.

Topic Closed

This topic has been closed to new replies.

About this Topic