Hide date on feature post in blog index

Hi again! I have used this code to hide the date on my blog posts:

.p-meta>span time, .p-meta>span time:after {
display: none;
}

Is there way to hide it here - in the feature posts - as well?

Thanks!

Hi there,

The easiest way would be to add the following CSS rule, but it will remove the category also.

.featured-meta {
    display: none;
}

If you want to keep the category, add the following code into your child theme’s functions.php file.

function x_ethos_featured_index() {

    $entry_id                    = get_the_ID();
    $index_featured_layout       = get_post_meta( $entry_id, '_x_ethos_index_featured_post_layout', true );
    $index_featured_size         = get_post_meta( $entry_id, '_x_ethos_index_featured_post_size', true );
    $index_featured_layout_class = ( $index_featured_layout == 'on' ) ? ' featured' : '';
    $index_featured_size_class   = ( $index_featured_layout == 'on' ) ? ' ' . strtolower( $index_featured_size ) : '';
    $is_index_featured_layout    = $index_featured_layout == 'on' && ! is_single();

    ?>

      <a href="<?php the_permalink(); ?>" class="entry-thumb<?php echo $index_featured_layout_class; echo $index_featured_size_class; ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
        <?php if ( $is_index_featured_layout ) : ?>
          <span class="featured-meta"><?php echo x_ethos_post_categories(); ?></span>
          <h2 class="h-featured"><span><?php x_the_alternate_title(); ?></span></h2>
          <span class="featured-view"><?php _e( 'View Post', '__x__' ); ?></span>
        <?php else : ?>
          <span class="view"><?php _e( 'View Post', '__x__' ); ?></span>
        <?php endif; ?>
      </a>

    <?php

  }

Hope that helps.

WOW! I really appreciate the effort you made on that php code. I took down both and will see which one works best in the long run. Many thanks!

You are most welcome.

Thanks

Hi again! So, I went the option of changing the php code. Here’s what it did:

Is there way to also remove the date from the slider?

If I use the CSS code, it removes the category again.

Thanks a lot for the help.

Hi there,

That requires another customization but should be easy. Please copy this file \framework\views\ethos\_post-slider.php from your main theme and place it in your child theme of the same folder structure. Then edit that file (in your child theme) and remove this code

/ <?php echo get_the_date( 'F j, Y' ); ?>

Hope this helps.

Hello, thanks for the response. I tried it, but it did not work. The date still shows in the slider box. I copied and saved the files from the file manager. I tried to edit out the code from both the file manager and from Wordpress, but neither one took that date out.

Here’s the code sample:

<?php // ============================================================================= // VIEWS/ETHOS/_POST-SLIDER.PHP // ----------------------------------------------------------------------------- // Outputs the post slider that appears at the top of the blog. // ============================================================================= $is_blog = is_home(); $is_archive = is_category() || is_tag(); if ( $is_blog || $is_archive ) : if ( $is_blog ) { $info = array( 'blog', NULL, NULL, '_x_ethos_post_slider_blog_display' ); } elseif ( $is_archive ) { $type = ( is_category() ) ? 'cat' : 'tag_id'; $info = array( 'archive', $type, get_queried_object_id(), '_x_ethos_post_slider_archives_display' ); } $slider_enabled = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_enable' ) == '1'; $count = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_count' ); $display = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_display' ); $blog_slider_is_enabled = $slider_enabled && $is_blog; $archive_slider_is_enabled = $slider_enabled && $is_archive; $is_enabled = $blog_slider_is_enabled || $archive_slider_is_enabled; switch ( $display ) { case 'most-commented' : $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'orderby' => 'comment_count', 'order' => 'DESC', $info[1] => $info[2] ); break; case 'random' : $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'orderby' => 'rand', $info[1] => $info[2] ); break; case 'featured' : $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'orderby' => 'date', 'meta_key' => $info[3], 'meta_value' => 'on', 'ignore_sticky_posts' => true ); break; } ?> <?php if ( $is_enabled ) : ?>
<div class="x-flexslider x-post-slider">
  <ul class="x-slides">

    <?php $wp_query = new WP_Query( $args ); ?>

    <?php if ( $wp_query->have_posts() ) : ?>
      <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

        <li class="x-slide">
          <article <?php post_class( 'x-post-slider-entry' ); ?> style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
            <a href="<?php the_permalink(); ?>">
              <div class="cover">
                <div class="middle">
                  <span class="featured-meta"><?php echo get_the_date( 'F j, Y' ); ?></span>
                  <h2 class="h-featured"><span><?php x_the_alternate_title(); ?></span></h2>
                  <span class="featured-view"><?php _e( 'View Post', '__x__' ); ?></span>
                </div>
              </div>
            </a>
          </article>
        </li>

      <?php endwhile; ?>
    <?php endif; ?>

    <?php wp_reset_query(); ?>

  </ul>
</div>

<script>
  jQuery(window).load(function() {
    jQuery('.x-post-slider').flexslider({
      controlNav   : false,
      selector     : '.x-slides > li',
      prevText     : '<i class="x-icon-chevron-left" data-x-icon="&#xf053;"></i>',
      nextText     : '<i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i>',
      animation    : 'fade',
      smoothHeight : true,
      slideshow    : true
    });
  });
</script>
<?php endif; ?> <?php endif; ?>

Hi there,

Kindly get back to us with the URL/User/Pass of your WordPress dashboard using the Secure Note functionality of the post to follow up the case.

Also, give us the FTP credentials using the Secure Note to test the fils you added in the Child Theme.

FTP Server Address
FTP Port
FTP Username
FTP Password

Kindly open up new threads for additional questions as it will help us to focus on each issue and give you a better support which you deserve. Having a long threads makes the maintaining job harder and also it will be harder for the other customers to find the correct information if they have similar issues. You are always welcomed to reply to this thread to follow up the same question.

Thank you.

What are you talking about here? Every question on this thread has to do with my initial question. I’ve been using your support for all 5 of my websites. I know how it works.

No offense, but every answer you have ever given me has had a snarky undertone, and, it’s usually incorrect information. I’ll wait and see if someone else answers before I follow your instructions.

Hi there,

Sorry for the inconvenience, I did not ever mean to be unpolite in any way. I personally apologize if you felt that way. The reason I added the new opening thread was that the question was originally about the posts index and not the posts slider. If we separate the threads which will have suitable titles it will help our other customers to find out the needed information much more easily.

I will be more than glad to follow up the current case as soon as you provide the information I asked to double check the case and see why the code is not working for your case.

Thank you.

Hi again. I have sent the secure note.

Here’s site where the date still shows on the feature slider.

I want the category to show, but not the dates - just like in the feature post box.

Thanks again!

Hi Jesamine,

I have logged in and the reason why the changes on the code you made did not take effect because it was placed in the wrong directory. It was in pro-child/framework/views when it should be in pro-child/framework/views/ethos.

I went ahead and move the file but as what you can see the category is removed instead of the date because in the code, you removed the category instead.

The code should be like this if you want the category to be shown and not the date:

<?php

// =============================================================================
// VIEWS/ETHOS/_POST-SLIDER.PHP
// -----------------------------------------------------------------------------
// Outputs the post slider that appears at the top of the blog.
// =============================================================================

$is_blog    = is_home();
$is_archive = is_category() || is_tag();

if ( $is_blog || $is_archive ) :

  if ( $is_blog ) {
    $info = array( 'blog', NULL, NULL, '_x_ethos_post_slider_blog_display' );
  } elseif ( $is_archive ) {
    $type = ( is_category() ) ? 'cat' : 'tag_id';
    $info = array( 'archive', $type, get_queried_object_id(), '_x_ethos_post_slider_archives_display' );
  }

  $slider_enabled = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_enable' ) == '1';
  $count          = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_count' );
  $display        = x_get_option( 'x_ethos_post_slider_' . $info[0] . '_display' );

  $blog_slider_is_enabled    = $slider_enabled && $is_blog;
  $archive_slider_is_enabled = $slider_enabled && $is_archive;
  $is_enabled                = $blog_slider_is_enabled || $archive_slider_is_enabled;

  switch ( $display ) {
    case 'most-commented' :
      $args = array(
        'post_type'      => 'post',
        'posts_per_page' => $count,
        'orderby'        => 'comment_count',
        'order'          => 'DESC',
        $info[1]         => $info[2]
      );
      break;
    case 'random' :
      $args = array(
        'post_type'      => 'post',
        'posts_per_page' => $count,
        'orderby'        => 'rand',
        $info[1]         => $info[2]
      );
      break;
    case 'featured' :
      $args = array(
        'post_type'      => 'post',
        'posts_per_page' => $count,
        'orderby'        => 'date',
        'meta_key'       => $info[3],
        'meta_value'     => 'on',
        'ignore_sticky_posts'	=> true
      );
      break;
  }

  ?>

  <?php if ( $is_enabled ) : ?>

    <div class="x-flexslider x-post-slider">
      <ul class="x-slides">

        <?php $wp_query = new WP_Query( $args ); ?>

        <?php if ( $wp_query->have_posts() ) : ?>
          <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

            <li class="x-slide">
              <article <?php post_class( 'x-post-slider-entry' ); ?> style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
                <a href="<?php the_permalink(); ?>">
                  <div class="cover">
                    <div class="middle">
                      <span class="featured-meta"><?php echo x_ethos_post_categories(); ?></span>
                      <h2 class="h-featured"><span><?php x_the_alternate_title(); ?></span></h2>
                      <span class="featured-view"><?php _e( 'View Post', '__x__' ); ?></span>
                    </div>
                  </div>
                </a>
              </article>
            </li>

          <?php endwhile; ?>
        <?php endif; ?>

        <?php wp_reset_query(); ?>

      </ul>
    </div>

    <script>
      jQuery(window).load(function() {
        jQuery('.x-post-slider').flexslider({
          controlNav   : false,
          selector     : '.x-slides > li',
          prevText     : '<i class="x-icon-chevron-left" data-x-icon="&#xf053;"></i>',
          nextText     : '<i class="x-icon-chevron-right" data-x-icon="&#xf054;"></i>',
          animation    : 'fade',
          smoothHeight : true,
          slideshow    : true
        });
      });
    </script>

  <?php endif; ?>

<?php endif; ?>

Kindly make the changes to the code.

Hope this helps.

Brilliant!! Thank you so much. It’s exactly as I wanted it. I really appreciate the effort you guys make to help out. It’s amazing.

all the best…
jes

You’re most welcome, Jes. :slight_smile:

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