Adding the date to a post
WordPress PHP – Add this PHP to the content.php template where you want the date to appear.
Letters jS is 1st etc. and d is 01. F is full Month and Y is full Year. More on date codes here > (External link).
Preferred FP UK Date format result is 02 February 2017.
<div class="fp-datex"><?php the_time(‘d F Y’);?></div>
Example (content.php):
<?php if (is_single()):
if (in_category(‘news’)): // display Featured Image in right col not content?
the_content();
?> <div class="fp-datex"><?php the_time(‘d F Y’);?></div><?php
else:
// display Featured Image in content the_post_thumbnail( ‘thumbnail’, array( ‘class’ => ‘alignleft’ ) ); the_content();
endif;
else: ?>
if (in_category(‘news’)): // display Featured Image in right col not content?
the_content();
?> <div class="fp-datex"><?php the_time(‘d F Y’);?></div><?php
else:
// display Featured Image in content the_post_thumbnail( ‘thumbnail’, array( ‘class’ => ‘alignleft’ ) ); the_content();
endif;
else: ?>
Done.
Fivepilchard Team
Updated Jan 2017