WordPress.org

Ready to get started?Download WordPress

Forums

Disabling time/date from specific post categories (4 posts)

  1. azzatron
    Member
    Posted 4 years ago #

    Hi there.
    I was wondering if theres a way to disable the time/date/author details from posts made in specific categories.

    I'm trying to use WP as a CMS, and would like posts (in certain categories) to appear as though they're not just a regular blog post. I'd like them to appear as an individual page (they'll be linked to from an external page, like a "portfolio" page for example), and removing the time/date/author details will help with this... If that makes any sense.

    I'd remove the time/date/author from all posts, however i'd like it to still display on the regular blog page/posts, so this wont work. Need to figure out a way of only removing these details from posts belonging to specific categories if possible.

    I'd appreciate any help with this! Hopefully it's even possible. Would be terrific if theres a pluging available (had no luck finding one yet).
    Cheers.

  2. MichaelH
    Member
    Posted 4 years ago #

    Use the condtional tag, in_category(). Kind of like this loop example.

    <?php
    if ( in_category(array('3','7','9')) ) {
    // do nothing
    } else {
    the_time('m.d.y');
    }
    ?>

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy
    the_time()

  3. azza
    Member
    Posted 4 years ago #

    Hi Michael, thanks for the reply.

    The example code you gave me looks pretty spot on. However i'm still a beginner at this and have been having trouble getting my head around where i put what, and code that may not be needed.

    Can you or anybody give me a hand whith some more specific code examples?

    Just to recap. I want the time/date/etc to display normally as default for blog posts.
    However i'd like the time/date/author/comments to be hidden for the posts in 3 specific categories. I'd also like the posts in these categories to not have the title "Blog" ontop of the page, which seems to be default. I'd rather have it say "portfolio" for example.

    I'm reading as much as I can on these conditional tags, but I havent really been able to get my head around things yet.

    I really apprecaite any further help I can get.
    Cheers

  4. MichaelH
    Member
    Posted 4 years ago #

    With the help of the Template Hierarchy article, determine what Template is displaying your posts and that will be the template to revise.

    Otherwise if you continue this thread provide a URL to download the theme your are using so someone might be able to jump in and help you.

Topic Closed

This topic has been closed to new replies.

About this Topic