Recently a customer asked if I could do some customization on his Word Press blog. based on the downtown-java-3column theme. (I had customized the design for him earlier).
His current theme placed the date and filed under category under each post. He wanted these 2 variables placed under the post headings.
Here’s what I did:
1. Created backup copies of the theme files.
2. Edited the php in the theme files below by searching for something similar to OR
index.php
home.php
archives.php
3. I moved the div class containing the time and category underneath the title (H1) tags.
4. Here is the original php code:
<div id="contentleft">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php the_content(__('Read more'));?><div style="clear:both;"></div>
<div class="postmeta">
<p><?php the_time('F j, Y'); ?> | Filed Under <?php the_category(', ') ?> <?php edit_post_link('(Edit)', '', ''); ?></p>
</div>
<!--
<?php trackback_rdf(); ?>
-->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
<p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?></p>
</div>
Here is the edited php code:
<div id="contentleft">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<div class="postmeta">
<p><?php the_time('F j, Y'); ?> | Filed Under <?php the_category(', ') ?> <?php edit_post_link('(Edit)', '', ''); ?></p>
</div>
<?php the_content(__('Read more'));?><div style="clear:both;"></div>
<!--
<?php trackback_rdf(); ?>
-->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
<p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?></p>
</div>
5. Upload the all edited theme files to the server.
6. View the edited theme to verify the changes have been implemented correctly.
7. Tips
When modifying or moving php code always:
-Make a backup of the original files in case you mess up.
-Check all theme files in case the php code occurs in more than 1 file.
-Check all edited files have been uploaded correctly.
-Test the modified theme so it now displays the date and category under the post headings.