0

Made template but how to make date to show only in posts not anywhere else?

<div class="date"><strong><?php the_date(); ?></strong></div>

This makes date to show in Home, Pages but i need only for posts. Something like if is post then the_date(); ?

3

There are two options:

  1. Create a separate single.php for posts and show the date there only.
  2. Use a condition:
if ( is_single() )
{
?><div class="date"><strong><?php the_date(); ?></strong></div><?php
}
  • So i put it in Index and from Main page also date was not showing. I was trying some more searches and figured a little bit about php and some tests until working and made like this- <?php if (is_page()) { } else { ?> <div class="date"><strong><?php the_date(); ?></strong></div> <?php } ?> You also helped to understand more WP and PHP THX :) – Kangarooo Apr 27 '13 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.