[resolved] include date for one category only? (4 posts)

  1. hristov
    Posted 10 years ago #

    this concerns a filter or SELECT, i guess:

    i need to include the date of a post only when the category_id is 4. for all other categories and posts i have removed the date displayed and want it to stay that way.

    what do i need to do and where please?

  2. hristov
    Posted 10 years ago #

    update: i've managed to add '&cat=4' to all urls of posts in this category. now i need the php for this:

    if cat='4' get date and display as 'day, date month year'

    ...and to know where to put it. within 'the_content' fucntion perhaps?

  3. bob58
    Posted 10 years ago #

    First: A post "knows" it's category-ID.
    Usually, you should change your templates (there is a line, where the date is displayed (for example in index.php).

    Change it to something like that:

    if (in_category(4))
    echo "posted on " . the_time('l, d.m.Y');

    That has to be done on every page in your theme where the date is / should be displayed.

  4. hristov
    Posted 10 years ago #

    excellent stuff bob... it worked first time! you probably saved me an hour of reading there.

Topic Closed

This topic has been closed to new replies.

About this Topic