How to hide category from posts?

Hello!

How can I hide Categories and comment from my posts?

I have tried
.category-X .page-header {
display: none;
}

.entry-meta {
display: none;
}

and some other ways, but nothing works.
I need to leave only Author.

Thank you!

Hi Michail,

Thanks for posting in!

Adding a custom css will not resolve your issue. Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

After the child theme is set up, please add the following code in your child theme’s functions.php file

// Custom Entry Meta
// =============================================================================

if ( ! function_exists( 'x_ethos_entry_meta' ) ) :
  function x_ethos_entry_meta() {

    //
    // Author.
    //

    $author = sprintf( ' %1$s %2$s</span>',
      __( 'by', '__x__' ),
      get_the_author()
    );


    //
    // Output.
    //

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

  }
endif;
// =============================================================================

You may edit your child theme in Appearance > Theme Editor and find the functions.php file on the right side.

Please let us know how it goes.

Great!
Thank you! It works!
One more question.

If I decide at one point to remove information about the Author, what will be the lines?

Thanks again!

Hello Michail,

If you want to remove the Author, it would mean that the entire post meta will display nothing. If that is the case, you do not have to use any code. Simply go to X > Theme Options > Blog > Content and disable the “Post Meta”.

Hope this helps.

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