Title: Category-dependent PHP functions
Last modified: August 18, 2016

---

# Category-dependent PHP functions

 *  Resolved [talino](https://wordpress.org/support/users/talino/)
 * (@talino)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/category-dependent-php-functions/)
 * Hi all,
 * I’m editing my template, and I would like WP to **not** display the date below
   the title if the post belongs to a certain category.
 * I found this line in the index.php file of the template :
 * `
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small
   >
 * This is the one I would like skipped, only when a post matches a certain category.
   Is this possible to do?
 * Also, is it possible, along the same lines, to not display a post at all in the
   main page, but only list it when the user is viewing its assigned category?
 * Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [onocrotalus](https://wordpress.org/support/users/onocrotalus/)
 * (@onocrotalus)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/category-dependent-php-functions/#post-481202)
 * I think you could use the `in_category` tag for the first part of your problem,
   and just make the line of `index.php` that you identified appear only when a 
   post belongs to certain categories. See [this page](http://codex.wordpress.org/Template_Tags/in_category)
   for details of usage.
 *  Thread Starter [talino](https://wordpress.org/support/users/talino/)
 * (@talino)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/category-dependent-php-functions/#post-481238)
 * Thanks a lot. Worked like a charm. I’m just starting to discover how flexible
   WP is…
 * Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Category-dependent PHP functions’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [talino](https://wordpress.org/support/users/talino/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/category-dependent-php-functions/#post-481238)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
