Theme for Wordpress: The home page

We create a different file for the homepage in order to have a different content and presentation. However, it differs little from the article page.

Page Structure

It differs from the page devoted to an article by the loop to display a list of summaries, and internal components that you choose to display, although most are common to those of the article page.

The header, footer and side panels are identical.

Global Page

<html>
<head></head>
<body>

<?php get_header(); ?>

<h1> 
<?php 
if (is_home()) bloginfo('name');
elseif (is_category()) single_cat_title();
elseif (is_search()) bloginfo('name');
else wp_title('',true);
?> </h1> <?php while ( have_posts() ) : the_post() ?> <div id="<?php the_ID() ?>" class="excerpt"> <h2><a href="<?php the_permalink() ?>"> <?php the_title() ?></a></h2> <div class="content"> <?php the_content('<span class="more">'.__('More...', '').'</span>'); ?> </div> </div> <?php wp_link_pages(); ?> <?php endwhile ?> <?php get_sidebar() ?> <?php get_footer(); ?> </body> </html>

Depending on the context of the site are displayed different title, category, topic. It is an option that can be deleted if it deems not appropriate. We can show only the category:

<h1> 
   <?php if(is_category()) single_cat_title(); ?>
</h1> 

The loop calls the function the_post () to displays the contents of the last posts, or an excerpts if it has been defined, or the beginning of the article until the <!-- more --> tag if it was inserted into the code of the article.

Using the identifier of the post as ID of the block may have a future use.

With the title of the article and the link, we construct a summary title to access the article. This is a h2 tag since there are several titles in the home page.

We chose to insert a button "More" to display the remaining, but it duplicates the link in the title and could be removed: leave the_content () without parameters.

Detail of the list of items

The components of the article:

<h2><a href="<?php the_permalink() ?>"> <?php the_title() ?></a></h2>
<?php
 the_content();
 the_author_link();
 the_date();
 the_category(', ');
 the_tags();
 edit_post_link();
 if (comments_open()) 
{
      comments_popup_link(
__('A comment?', ''),
__('1 comment', ''),
__('% comments', ''),
'comments-link',
'Shuttt'); } ?>

Again we display the edit link, which is not done in all themes, but it is a wrong. Remember that it only appears to the authors.

The comment block contains parameters useful on the homepage, which are not on articles. In order:

Documentation

The home page can use the components of articles, and widgets to access the database.