Daniel
Daniel

Reputation: 7038

How to Remove Date From Posts

I have the date in all of my posts and I'd like to remove them, both from the main page and from individual post pages. My site is SweatingTheBigStuff.com.

I think this is the code to look at. It's in the index.php file and there is something similar in the single.php file.

<?php ob_start(); ?>
<?php $icons = array(); ?>
<?php if (!is_page()): ?><?php ob_start(); ?><?php the_time(__('F jS, Y', 'kubrick')) ?>
<?php $icons[] = ob_get_clean(); ?><?php endif; ?>
<?php if (!is_page()): ?>
<?php ob_start(); ?><?php _e('By', 'kubrick'); ?>: <title="<?php _e('By', 'kubrick'); ?>">
<?php the_author() ?></a>
<?php $icons[] = ob_get_clean(); ?><?php endif; ?><?php if (0 != count($icons)): ?>

Upvotes: 0

Views: 277

Answers (1)

kevtrout
kevtrout

Reputation: 4984

WordPress uses a function called the_time() to display date and time information.
Turn this:

<?php if (!is_page()): ?>
    <?php ob_start(); ?><?php the_time(__('F jS, Y', 'kubrick')) ?>
    <?php $icons[] = ob_get_clean(); ?>
<?php endif; ?>

Into this:

<?php if (!is_page()): ?>
    <?php ob_start(); ?><?php //the_time(__('F jS, Y', 'kubrick')) ?>
    <?php $icons[] = ob_get_clean(); ?>
<?php endif; ?>

Or just remove <?php //the_time(__('F jS, Y', 'kubrick')) ?> all together.

Upvotes: 1

Related Questions