Remove categories from Ethos carousel & recent post

Hello again,

I’m trying to remove the categories from the ethos carousel and the recent post? I’ve tried using the code found here https://theme.co/apex/forum/t/ethos-post-header-carousel-help/19833/5 but I still want the carousel to have that movement, author and date. Thank you in advance.

Aaron

Hello There,

Thanks for writing in!

1.) To remove the categories from the ethos carousel, please add the following CSS code in the X > Theme Options > Global CSS (http://prntscr.com/evui3r)

.x-post-carousel-meta .entry-cover-categories {
    visibility: hidden;
}

.x-post-carousel-meta .entry-cover-author:after {
    content: "";
    display: block;
    position: absolute;
    left: 25%;
    right: 25%;
    height: 1px;
    background-color: rgba(255,255,255,0.125);
    bottom: 0;
}

2.) And to remove the categories from the recent post, 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 Ethos 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()
    );


    //
    // Date.
    //

    $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() )
    );


    //
    // 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,
        $date,
        $comments
      );
    }

  }
endif;

We would loved to know if this has work for you. Thank you.

Hello again,
The first code worked, but the second code didn’t work.

I only want to show the title on featured carousel, and the blog post on the home page. Sorry if that was a bit ambiguous before.

Hi,

You can try this code instead.

function x_ethos_entry_cover( $location ) {

    if ( $location == 'main-content' ) { ?>

      <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <a class="entry-cover" href="<?php the_permalink(); ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
          <h2 class="h-entry-cover"><span><?php x_the_alternate_title(); ?></span></h2>
        </a>
      </article>

    <?php } elseif ( $location == 'post-carousel' ) { ?>

      <?php GLOBAL $post_carousel_entry_id; ?>

      <article <?php post_class(); ?>>
        <a class="entry-cover" href="<?php the_permalink(); ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
          <h2 class="h-entry-cover"><span><?php ( $post_carousel_entry_id == get_the_ID() ) ? the_title() : x_the_alternate_title(); ?></span></h2>
          <div class="x-post-carousel-meta">
            <span class="entry-cover-author"></span>
            <span class="entry-cover-title"><?php ( $post_carousel_entry_id == get_the_ID() ) ? the_title() : x_the_alternate_title(); ?></span>
            <span class="entry-cover-date"></span>
          </div>
        </a>
      </article>

    <?php }

  }

You can then disable post meta under Theme Options > Blog > Content

Hope that helps

Hello again,

I tried the code provided, and the categories still show in the “Big blog post” and the post carousel. I only want the meta to show on the “Small post”

Hi again,

Try adding the following code in the Theme Options > CSS:

.x-post-carousel-meta .entry-cover-categories, .entry-thumb.featured .featured-meta, .x-post-slider-entry .featured-meta {
    display: none;
}

Let us know how this goes!

Hey thanks that worked when I put both of the codes together.

You’re welcome! :slight_smile:

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