Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress The WordPress Template Hierarchy How WordPress Templates Work How WordPress Templates Work

Stavros Sofroniadis
Stavros Sofroniadis
Courses Plus Student 1,503 Points

About Page.php

It was mentioned in video tutorial that page.php files controls all related pages of a web site.

Dont have php depth knowledge, will mention some information about the following code but also have questions. If you could help,

<?php//opening php tag /**

  • The template for displaying all pages *
  • This is the template that displays all pages by default.
  • Please note that this is the WordPress construct of pages and that
  • other 'pages' on your WordPress site will use a different template. *
  • @package WordPress
  • @subpackage Twenty_Fourteen
  • @since Twenty Fourteen 1.0 */

get_header(); ?> //call of function header?

<div id="main-content" class="main-content"> //creation of 1st div with id=main-content & class=main-content what is the reason to have id & class for the same div?

<?php//opening php tag if ( is_front_page() && twentyfourteen_has_featured_posts() ) { // Include the featured content template. get_template_part( 'featured-content' ); }

if statement in which we call 2 functions (is_front_page() & twentyfourteen_has_featured_posts() ) if (is_front_page() and twentyfourteen_has_featured_posts()) happens then call the function get_template_part( 'featured-content' ); with a parameter named "featured-content'" ?> <div id="primary" class="content-area"> //creation of 2nd div with id=primary & class=content-area <div id="content" class="site-content" role="main"> //creation of 3rd div with id=content & class=site-content what is tag name role?

TEST!!! <?php//opening php tag // Start the Loop. while ( have_posts() ) : //we start a while loop with a condition to stop under a cirmicstance. in this case to call in every loop the function have_posts() until? If you could mentio which is the condition in this while loop. the_post();//we call the function named the_post();

            // Include the page content template.
            get_template_part( 'content', 'page' );

//call the function named get_template_part( 'content', 'page' ); Above we call the function named get_template_part( 'content', 'page' );?

            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) {

//if statement, we use if to say if function named "comments_open()" or function named "get_comments_number() )" have been called then call the function named comments_template(); Please mention any coments if it is wrong endwhile; //endwhile means? ?>//end of php tag

    </div><!-- #content -->//close div with id=content
</div><!-- #primary -->//close div with id=primary
<?php get_sidebar( 'content' ); ?>

//we call function named " get_sidebar( 'content' );" with a parameter? </div><!-- #main-content -->//close div with id=main-content

<?php//opening or closing php tag? get_sidebar(); //call function named get_sidebar(); get_footer(); //call function named get_footer();

Thank You,