WordPress.org

Ready to get started?Download WordPress

Forums

Boilerplate theme - index.php not showing everything??? (5 posts)

  1. schoolspeak
    Member
    Posted 3 years ago #

    I'm a newbie to WordPress. I've activated Boilerplate (and have a successful child theme based on it.) Problem is, my index.php seems to not have as much in it as it should!

    It basically runs the loop and calls the other pieces (header, footer, sidebar).

    I can find the css -- that's not the problem.

    The problem is: When I'm actually viewing the document online (well, through Wamp server), I say "view source" and it shows me things I'd like to edit/delete/add to. I just want to FIND these things in a file somewhere in the boilerplate theme. I expected these things would be in index.php but they're not. I understand some of things are in the header, footer, sidebar, etc areas.

    ******************************************************************
    What I think SHOULD be in index.php that isn't in the one I downloaded:

    <!DOCTYPE html>
    <!--[if lt IE 7 ]><html dir="ltr" lang="en-US" class="no-js ie ie6 lte7 lte8 lte9"><![endif]-->
    etc
    <head>
    <meta charset="UTF-8" />
    title
    <link rel="stylesheet" href="http://localhost/JP/wp-content/themes/boilerplate-child/style.css" />
    class="current_page_item">Home<li class="page_item page-item-2">Sample Page</div>
    </nav>
    </div>
    </body>
    </html>
    ******************************************************************

    You get the idea. Now I will copy and paste what my index.php actually has. Where's the beef??? Thanks in advance, I know this question has an obvious answer but it's driving me nuts.

    <?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 Boilerplate
    * @since Boilerplate 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(); ?>

  2. martcol
    Member
    Posted 2 years ago #

    Well I'll have a go here but I am a complete PHP numpty, trying to figure out how to drive WordPress which feels to me like a lorry with no brakes!

    The index.php file is obviously calling the header.php and the loop.php. It's the loop.php that has the real meat and that will call all kinds of other things too. The loop here is in three main sections that will respond to different post types, gallery category, asides category and all other posts. After that things get a bit hazy. I'd suggest that it is in there that you want to think about how your page gets rendered.

    What you might try doing is taking a look at other themes that use a similar loop and see how they add elements to it. That's what I am trying. I think that Boilerplate is based on Twentyten?

    If that's not helping then I am as stuck/more stuck than you. I'm just having a go.

    Best of luck.

    Martin

  3. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    The get_header() function calls header.php.
    The get_template_part( 'loop', 'index' ) file calls loop-index.phploop.php`.
    The get_sidebar() function calls sidebar.php.

  4. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    The get_header() function calls header.php.
    The get_template_part( 'loop', 'index' ) file calls loop-index.php or loop.php.
    The get_sidebar() function calls sidebar.php.
    The get_footer() function calls footer.php.

    You'll find the markup you're looking for in these template-part files.

  5. schoolspeak
    Member
    Posted 2 years ago #

    Thanks to both. I'm not quite sure why that was so hard for me to find the first, second, third, etc. times around. It's clear as day now.

    And Hotmale, good luck with the lorry. Let's just hope we don't run into each other on the street since we'd definitely crash into each other! ;)

Topic Closed

This topic has been closed to new replies.

About this Topic