index.php

Description: The main blog page. Displays a list of blog posts in reverse chronological order.

This template includes the following templates:

Template Code

<?php get_header() ?>

<div id="container">
  <div id="content">
    <div id="nav-above" class="navigation">
      <div class="nav-previous">
        <?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'sandbox')) ?>
      </div>
      <div class="nav-next">
        <?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'sandbox')) ?>
      </div>
    </div>
    <?php while ( have_posts() ) : the_post() ?>
    <div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
      <h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark">
        <?php the_title() ?>
        </a></h2>
      <div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>">
        <?php unset($previousday); printf(__('%1$s – %2$s', 'sandbox'), the_date('', '', '', false), get_the_time()) ?>
        </abbr></div>
      <div class="entry-content">
        <?php the_content(''.__('Read More <span class="meta-nav">»</span>', 'sandbox').''); ?>
        <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'sandbox') . '&after=</div>') ?>
      </div>
      <div class="entry-meta"> <span class="author vcard"><?php printf(__('By %s', 'sandbox'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span> <span class="meta-sep">|</span> <span class="cat-links"><?php printf(__('Posted in %s', 'sandbox'), get_the_category_list(', ')) ?></span> <span class="meta-sep">|</span>
        <?php the_tags(__('<span class="tag-links">Tagged ', 'sandbox'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
        <?php edit_post_link(__('Edit', 'sandbox'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n"); ?>
        <span class="comments-link">
        <?php comments_popup_link(__('Comments (0)', 'sandbox'), __('Comments (1)', 'sandbox'), __('Comments (%)', 'sandbox')) ?>
        </span> </div>
    </div>
    <!-- .post -->
    <?php comments_template() ?>
    <?php endwhile ?>
    <div id="nav-below" class="navigation">
      <div class="nav-previous">
        <?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'sandbox')) ?>
      </div>
      <div class="nav-next">
        <?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'sandbox')) ?>
      </div>
    </div>
  </div>
  <!-- #content -->
</div>
<!-- #container -->
<?php get_sidebar() ?>
<?php get_footer() ?>

This template includes the following tags:

  • __() is a WordPress function used to mark a string for translation to another language. It is similar to _e(), except that __() returns the string while _e() echoes it.
  • comments_popup_link() is a WordPress tag which displays a link either to the comments pop-up window or to the normal comments page, depending on which has been selected in the current template.
  • comments_template() is a WordPress include tag which includes the file comments.php.
  • edit_post_link() is a Wordpress tag which displays a link to edit the current post (assuming the user is logged in and has the appropriate permissions).
  • get_author_link() has been deprecated. Use get_author_posts_url() instead.
  • get_footer is a WordPress include tag which includes the file footer.php.
  • get_header is a WordPress include tag which includes the file header.php.
  • get_sidebar is a WordPress include tag which includes the file sidebar.php.
  • get_the_author() is a WordPress tag which returns the name of the author of the post.
  • get_the_category_list() is a WordPress function which creates a list of categories.
  • get_the_time() is a WordPress tag which returns the time of the current post. It must be used within The Loop.
  • get_the_title() is a WordPress tag which accepts a post ID and returns the title of the post.
  • have_posts() is part of The Loop.
  • next_posts_link() is a WordPress tag. Counterintuitively, it creates a link to the previous posts.
  • previous_posts_link() is a WordPress tag. Despite its name, it creates a link to the next posts.
  • printf() is a PHP string function used to output a formatted string.
  • sandbox_post_class() is a Sandbox-specific class defined in the functions.php file. According to the Sandbox Readme, "It adds semantic classes to each post div element, relative to the actual post it contains."
  • sprintf() is a PHP string function which returns a formatted string.
  • the_content() is a Wordpress tag which displays the contents of the current post. This tag must be used within The Loop.
  • the_date() is a WordPress tag which displays or returns the date of a post.
  • the_ID() is a WordPress tag which displays the numeric ID of the current post. It must be within The Loop.
  • the_permalink() is a WordPress tag which displays the URL for the permalink to the post currently being processed in The Loop. This tag must be used within The Loop.
  • the_post() is a WP_Query method: "Advance onto the next post, and set the global $post variable."
  • the_tags() is a WordPress tag which displays a link to the tag or tags a post belongs to. This tag should be used within The Loop..
  • the_time() is a WordPress tag which displays the time of the current post. This tag must be used within The Loop.
  • the_title() is a WordPress tag which displays or returns the title of the current post. This tag must be used within The Loop.
  • unset() is a PHP variable handling function which destroys the specified variables. (According to a note in the PHP Manual, unset() is not actually a function, but a language construct.)
  • wp_link_pages() is a WordPress tag which displays page-links for paginated posts. It replaces the deprecated link_pages().
  • wp_specialchars() is a WordPress function that is "like the PHP function htmlspecialchars except it doesn't double-encode HTML entities." (Function Reference)

HTML Skeleton

[HEADER.PHP]

<div id="container">
	<div id="content">

		<div id="nav-above" class="navigation">
			<div class="nav-previous">
				<span class="meta-nav">«</span> Older posts
			</div>  
			<div class="nav-next">
				<span class="meta-nav">»</span> Newer posts
			</div>
		</div>

		<div id="post-[#]" class="hentry p1 post publish author-[AUTHOR] category-[CATEGORY] tag-[TAG] y[YEAR] m[MONTH] d[DAY] h[HOUR]">
			<h2 class="entry-title"><a rel="bookmark"> [POST TITLE] </a></h2>
			<div class="entry-date"><abbr class="published" title="[DATE]"> [MONTH DAY, YEAR] – [TIME] </abbr></div>
			<div class="entry-content">
				<p>[POST CONTENT]</p>
				<p><a rel="attachment wp-att-[#]">[IMAGE]</a></p>
			</div>
			<div class="entry-meta">
				<span class="author vcard">By <a class="url fn n">[AUTHOR]</a></span>
				<span class="meta-sep">|</span>
				<span class="cat-links">Posted in <a rel="category tag">[CATEGORY]</a></span>
				<span class="meta-sep">|</span>
				<span class="tag-links">Tagged <a rel="tag">[TAG]</a></span>
				<span class="meta-sep">|</span>
				<span class="edit-link">[EDIT LINK]</span>
				<span class="meta-sep">|</span>
				<span class="comments-link">[COMMENTS LINK]</span>
			</div>
		</div>
		<!-- .post -->

		<div id="nav-below" class="navigation">
			<div class="nav-previous">
				<span class="meta-nav">«</span> Older posts
			</div>  
			<div class="nav-next">
				<span class="meta-nav">»</span> Newer posts
			</div>
		</div>

	</div>
	<!-- #content -->
</div>
<!-- #container -->

[SIDEBAR.PHP]

[FOOTER.PHP]

Related CSS Styles

Resources

  • N/A