The following tutorial is about designing your own single.php page in wordpress theme.

In WordPress theme, Single.php used to display the single post with the author information, comment and reply section.

First create a blank php file and save as single.php. Then copy all the code from index.php file and paste it to single.php file. Now delete all code in between “<div id=”container”>.” tag and replace the code below:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div <?php post_class() ?>>

<h2><?php the_title(); ?></h2>

<ul class="postmetadata clearfix">

<li class="author">By <?php the_author_posts_link(); ?></li>

<li><?php the_time('l, F jS, Y') ?></li>

<li><?php the_category(', ') ?></li>


<div><div id="post_thumb"><?php the_post_thumbnail(); ?></div>


<?php the_content('<p class="serif">Read More &raquo;</p>'); ?>

<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>

<?php if(function_exists('wp_print')) { print_link(); } ?>



Now add author profile box including author name, author bio. Copy and paste the code below:

<!--author box-->


<?php echo get_avatar( get_the_author_email(), $size = '80'); ?>

<div class="authortext">

<h4>About <?php the_author_posts_link(); ?></h4>

<p><?php the_author_description(); ?></p>




Author Info Box

The single post page with author name and bio becomes complete with it. Now you have to add comments section to our Post. Just copy and paste just under author box in this code:

<?php comments_template(); ?>

<?php endwhile; else: ?>

<p>Sorry, no posts matched your criteria.</p>

<?php endif; ?>

Along with the header, sidebar, footer and comments our single.php page is ready.

Categories: Tutorials, Wordpress


Notice: the_author_description is deprecated since version 2.8.0! Use the_author_meta('description') instead. in /home/greetbpn/public_html/ on line 4329
He is a freelance graphic designer with more than 15 years of design experience, including both print and web design.

.. Write a Guest Post ..

Comments are closed.

Copyright © 2019