1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I remove the date from posts?

Discussion in 'Blogging' started by Ranko Jones, Jul 20, 2011.

  1. Ranko Jones

    Ranko Jones BANNED BANNED

    Joined:
    Mar 3, 2011
    Messages:
    1,677
    Likes Received:
    146
    I tried the plugin but like alot of ppl it seems it just flat out didn't work.

    I've been reading about remove the
    Code:
    <?php the_date(); ?> or this:
     
      Code:
     <?php the_time(); ?> 
    
    but when I look in single.php or whatever else they say I don't see those lines...

    What else can I try?
     
  2. CyberSEO

    CyberSEO Senior Member

    Joined:
    Jul 14, 2011
    Messages:
    939
    Likes Received:
    256
    Occupation:
    programmer
    Home Page:
    Can you post your single.php here? If it does display the post date of course.
     
  3. Ranko Jones

    Ranko Jones BANNED BANNED

    Joined:
    Mar 3, 2011
    Messages:
    1,677
    Likes Received:
    146
    That is exactly what I was saying it doesn't display it, hence why I wrote a post about it :D.

    Here it is anyway:

    Code:
    <?php
    /**
     * @package WordPress
     * @subpackage JohnLoan
     */
    
    get_header(); ?>
    
            <div id="primary">
                <div id="content" role="main">
    
                <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
                    <?php johnloan_content_nav( 'nav-above' ); ?>
    
                    <?php get_template_part( 'content', 'single' ); ?>
    
                    <?php johnloan_content_nav( 'nav-below' ); ?>
    
                    <?php comments_template( '', true ); ?>
    
                <?php endwhile; // end of the loop. ?>
    
                </div><!-- #content -->
    
                <?php get_sidebar(); ?>
            </div><!-- #primary -->
    
    <?php get_footer(); ?>
     
  4. CyberSEO

    CyberSEO Senior Member

    Joined:
    Jul 14, 2011
    Messages:
    939
    Likes Received:
    256
    Occupation:
    programmer
    Home Page:
    According to this line:

    Code:
    <?php get_template_part( 'content', 'single' ); ?>
    You need to open content.php and find the date output there. Usually it's somewhere in the printf() function, e.g. something like this:

    Code:
    <time class="entry-date" datetime="%2$s" pubdate>%3$s</time>
    Simple remove it.
     
    • Thanks Thanks x 1
  5. Ranko Jones

    Ranko Jones BANNED BANNED

    Joined:
    Mar 3, 2011
    Messages:
    1,677
    Likes Received:
    146
    Ok, that's solved half of it. The date no long comes up on the front page however it is still showing in individual posts...

    Also it still says 'posted on by X'

    I would either like to get rid of the 'on' so it just says 'posted by X' or get rid of it all. Probably the 1st one as it still leaves a bit of the personal touch with the penname there.

    Or perhaps ideally simply 'by X' as I'm going for more of a static pages feel so getting rid of the post bit would be better though not a huge deal.
     
    Last edited: Jul 20, 2011
  6. CyberSEO

    CyberSEO Senior Member

    Joined:
    Jul 14, 2011
    Messages:
    939
    Likes Received:
    256
    Occupation:
    programmer
    Home Page:
    You can also remove the "posted on by" part as you did with date. Actually you can remove the whole printf() function with all its variables.

    If the message remains somewhere else (e.g. in single posts), you also need to remove it from the content-single.php.
     
  7. cyberzilla

    cyberzilla Elite Member Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    2,204
    Likes Received:
    3,364
    Location:
    zeta reticuli
    The below given post suggest to check in other places like index.php, page,php, archives.php..

    Code:
    http://www.wpthemes.com/wp-hacks-how-to-remove-date-from-posts/
    Also you may get a solution reading these threads..

    Code:
    site:en.forums.wordpress.com How do I remove the date from posts
     
  8. CyberSEO

    CyberSEO Senior Member

    Joined:
    Jul 14, 2011
    Messages:
    939
    Likes Received:
    256
    Occupation:
    programmer
    Home Page:
    That's not the OP's case. Haven't you seen his single.php? All the mentioned above files (index.php, page,php, archives.php) will not contain anything to fix (in this particular case) - checking them is just a waste of time.
     
  9. Ranko Jones

    Ranko Jones BANNED BANNED

    Joined:
    Mar 3, 2011
    Messages:
    1,677
    Likes Received:
    146
    Well I just happened to be reading the hacks one myself by coincidence and I took a look in archives and it has alot of time/date info so could it be causing the issue or not?

    Code:
    <?php
    /**
     * @package WordPress
     * @subpackage JohnLoan
     */
    
    get_header(); ?>
    
            <section id="primary">
                <div id="content" role="main">
    
                    <?php the_post(); ?>
    
                    <header class="page-header">
                        <h1 class="page-title">
                            <?php if ( is_day() ) : ?>
                                <?php printf( __( 'Daily Archives: <span>%s</span>', 'johnloan' ), get_the_date() ); ?>
                            <?php elseif ( is_month() ) : ?>
                                <?php printf( __( 'Monthly Archives: <span>%s</span>', 'johnloan' ), get_the_date( 'F Y' ) ); ?>
                            <?php elseif ( is_year() ) : ?>
                                <?php printf( __( 'Yearly Archives: <span>%s</span>', 'johnloan' ), get_the_date( 'Y' ) ); ?>
                            <?php else : ?>
                                <?php _e( 'Blog Archives', 'johnloan' ); ?>
                            <?php endif; ?>
                        </h1>
                    </header>
    
                    <?php rewind_posts(); ?>
                    
                    <?php johnloan_content_nav( 'nav-above' ); ?>
    
                    <?php /* Start the Loop */ ?>
                    <?php while ( have_posts() ) : the_post(); ?>                
    
                        <?php get_template_part( 'content', get_post_format() ); ?>
    
                    <?php endwhile; ?>
    
                    <?php johnloan_content_nav( 'nav-below' ); ?>                
    
                </div><!-- #content -->
    
                <?php get_sidebar(); ?>
            </section><!-- #primary -->
    
    <?php get_footer(); ?>
     
  10. CyberSEO

    CyberSEO Senior Member

    Joined:
    Jul 14, 2011
    Messages:
    939
    Likes Received:
    256
    Occupation:
    programmer
    Home Page:
    You said you want to remove the date from single posts. Right? If so, check your content-single.php.

    As about your archives.php, so it's a way different story.
     
    • Thanks Thanks x 1
  11. Ranko Jones

    Ranko Jones BANNED BANNED

    Joined:
    Mar 3, 2011
    Messages:
    1,677
    Likes Received:
    146
    Boom! there it is :)

    That got it.

    Cheers.
     
  12. bangkai

    bangkai Junior Member

    Joined:
    Dec 2, 2008
    Messages:
    173
    Likes Received:
    18
    Maybe you don't have to remove the line to make the date disappear. Simply put double slash "//" in it. Example:

    Code:
    <?php // the_date(); ?>
    So next time if you decide to show the post date, you don't have to google it. Just remove the // :D
     
    • Thanks Thanks x 1