How do I remove the date from every blog post?

How do I remove the date that is listed on each blog post on my blog. I want to keep the author, categories, and comments.

Here is a link to a sample post. http://www.keslerscience.com/guide-to-using-interactive-notebooks-in-the-science-classroom/

Chris

Hi Chris,

To remove the date, you can add this in your child theme’s functinos.php file(wp-content/themes/x-child/functions.php)

function x_renew_entry_meta() {

    //
    // Author.
    //

    $author = sprintf( '<span>%s</span>',
      get_the_author()
    );


  

    //
    // Categories.
    //

    if ( get_post_type() == 'x-portfolio' ) {
      if ( has_term( '', 'portfolio-category', NULL ) ) {
        $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
        $separator         = ', ';
        $categories_output = '';
        foreach ( $categories as $category ) {
          $categories_output .= '<a href="'
                              . get_term_link( $category->slug, 'portfolio-category' )
                              . '" title="'
                              . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                              . '"> '
                              . $category->name
                              . '</a>'
                              . $separator;
        }

        $categories_list = sprintf( '<span>%s</span>',
          trim( $categories_output, $separator )
        );
      } else {
        $categories_list = '';
      }
    } else {
      $categories        = get_the_category();
      $separator         = ', ';
      $categories_output = '';
      foreach ( $categories as $category ) {
        $categories_output .= '<a href="'
                            . get_category_link( $category->term_id )
                            . '" title="'
                            . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                            . '">'
                            . $category->name
                            . '</a>'
                            . $separator;
      }

      $categories_list = sprintf( '<span>%s</span>',
        trim( $categories_output, $separator )
      );
    }


    //
    // Comments link.
    //

    if ( comments_open() ) {

      $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
      $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
      $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );


	  $text = ( 0 == $number ) ? __( 'Leave a Comment', '__x__' ) : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );


	  $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
        esc_url( $link ),
        esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
        $text
      );

    } else {

      $comments = '';

    }


    //
    // Output.
    //

    if ( x_does_not_need_entry_meta() ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
        $author,
        $categories_list,
        $comments
      );
    }

  }

If you haven’t installed a child theme yet, you may refer to the link below for your guid on how to set it up.

Thanks

Great support! Thanks. I was able to add the child theme and make the change in a matter of minutes and it worked flawalessly.

Chris

Hey There,

You’re welcome! We are just glad we were able to help you out.
We appreciate for letting us know that it has worked for you.

Cheers.

Should I place the text into the “Additional CSS” section of the Customizer? Or is there another way to get to the child theme’s functions area?

Hello There,

Thanks for updating this thread.

Please be advised that “Additional CSS” area is for css codes only. Any css code added in this section will take effect after loading the theme’s style.css and child theme’s style.css. Any php code or html code added in this area will not do anything and would even create an issue in the site. So please only add valid and correct css codes in the “Additional CSS” area.

If you want to use the custom function as given in this thread, you will have to place it in your Child theme’s functions.php file. You should be able to edit the file in Appearance > Editor (only if you are allowed to edit a file).

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.