Navigation

This content is old and no longer supported. You may use at your own risk, but no official support will be provided for anything listed here. If you are a Themeco customer, we invite you to check out our new community and forums, Apex.

  • Author
    Posts
  • #2832

    John B
    Participant

    Hi,

    I am using a child theme. Can you tell me how to remove the information that is displayed underneath the post title. For example, my posts currently display the author, date, category, and leave a comment.

    I would like to remove all of this and only display the post title.

    #2833

    Kory
    Keymaster

    Hey John,

    If you click on the Screen Options tab in the upper right corner of the admin panel when you’re on a post/page, you can turn a lot these elements off if you don’t need them.

    Let us know if that lets you accomplish what you’re setting out to do.

    Thanks!

    #2834

    John B
    Participant

    I am referring to once I publish the post. I have all the “Screen Options” checked and still do not see an option to remove this information from the published post. Is this hard coded into the template?

    #2835

    Kory
    Keymaster

    John,

    My apologies, I thought you were referring to the meta boxes in the admin area. Depending on the stack you’re using, you will need to go find the function for this in the stack specific functions file. You can find these at the following path in X:

    /framework/functions/

    Once you are here, open up the file corresponding to the Stack you are using. For example, if you are using the Integrity Stack, you will need to open integrity.php.

    To continue on with the Integrity example, you would then need to find the x_integrity_entry_meta() function. Next, copy this function into the functions.php file of your child theme.

    Once you have done that, you can edit this function as needed. The parts you’ll want to edit are originally on lines 166-175 of the integrity.php file. Simply remove the items you don’t want, and make sure to remove the corresponding elements from line 169 in the %1$s%2$s%3$s%4$s string. For example, if you wanted to remove the $author and $categories_list portions of this, your code would need to look something like the following:

    if ( get_post_type() == 'page' ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s%2$s</p>',
        $date,
        $comments
      );
    }

    Let us know if you need anything else.

    Thanks!

    #119524

    rwhitted
    Participant

    Could you help me identify the same for Ethos – I have ethos.php open and am looking to remove post dates from every post, making sure it doesn’t keep the “/” after what then becomes a blank space.

    Also concerned that once the date is gone, there will be a blank space on the featured posts at the very top of the page – using Ethos Main Demo 1 (http://theme.co/x/demo/ethos/1/)

    Thank you!

    #119629

    Zeshan
    Member

    Hi there,

    Thank you for writing in!

    Instead of that, please try adding the following code in your child theme’s functions.php file:

    if ( ! function_exists( 'x_ethos_entry_meta' ) ) :
      function x_ethos_entry_meta() {
    
        $author = sprintf( ' by %s</span>',
          get_the_author()
        );
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    
        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>In %s',
              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>In %s',
            trim( $categories_output, $separator )
          );
        }
    
        if ( comments_open() ) {
          $title  = get_the_title();
          $link   = get_comments_link();
          $number = get_comments_number();
          if ( $number == 0 ) {
            $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 ) ),
              __( 'Leave a Comment' , '__x__' )
            );
          } else if ( $number == 1 ) {
            $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 ) ),
              $number . ' ' . __( 'Comment' , '__x__' )
            );
          } else {
            $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 ) ),
              $number . ' ' . __( 'Comments' , '__x__' )
            );
          }
        } else {
          $comments = '';
        }
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
          printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
            $categories_list,
            $author,
            // $date,
            $comments
          );
        }
    
      }
    endif;
    

    After that, copy the file wp-content/themes/x/framework/views/ethos/_post-slider and add in your child theme’s folder /framework/views/ethos/, open in a text editor and replace the following line of code (line no. 57):

    <span class="featured-meta"><?php echo x_ethos_post_categories(); ?> / <?php echo get_the_date( 'F j, Y' ); ?></span>
    

    With:

    <span class="featured-meta"><?php echo x_ethos_post_categories(); ?></span>
    

    Hope this helps. 🙂

    Thank you.

    #125177

    rwhitted
    Participant

    That made the site disappear… does it matter where in the functions.php document I paste that code?

    Thank you – site’s almost complete and it looks great! Client is very happy.

    #125360

    Kosher K
    Member

    Hi There,

    Can you please provide URL of your site and wordpress & FTP access for us to check on your set-up.

    Thank you

    #127103

    rwhitted
    Participant
    This reply has been marked as private.
    #127233

    Zeshan
    Member

    Hi there,

    Thank you for writing in!

    Upon checking, the code has been added and the site is opening just fine here. Would you mind confirming the issue again?

    Regarding the date from post carousel, please try adding following CSS code under Custom > CSS in the Customizer:

    .x-post-carousel-meta>span.entry-cover-date {
       display: none;
    }
    

    Cheers!

    #128500

    rwhitted
    Participant

    The code above pasted into the Custom CSS field of the Customizer worked – it was slightly different from code suggested earlier, and did the trick!

    Sorry I wasn’t clear – the site wasn’t still invisible… I removed the code suggestions above (editing the functions.php file) that made it disappear so the site wasn’t down for any period of time.

    All is good. Thanks! Already thinking of other clients I can use X with.

    #128664

    Kory
    Keymaster

    You’re welcome!

    We certainly appreciate your repeat business and purchasing additional copies for other clients 🙂

    #147194

    Raechelle F
    Participant

    This may be a little too late. But you could go to Customizer > Blog and under content there is an option for Post Meta and you can just turn it off.

    #147444

    Rubin
    Keymaster

    Thanks for sharing!

    #159238

    SKarim14
    Participant

    Hi, what code do I need to put on Customizer > Custom > CSS to remove dates, author, and categories from ALL PUBLISHED POSTS? I am using Integrity stack. It would be very helpful to get the exact code that can do the job above.

Join Apex

This content is old and no longer supported. We invite you to check out our new community and forums, Apex.

Join Apex