Date format on Post Carroussel - Ethos Stack

Even though I am using a date formar of Day, Month and Year ( in portuguese ) the post carroussel on Ethos is showing the dates in USA format like but with the words in portuguese…


It should be “12 de dezembro de 2019” and not “Dezembro 12, 2019”

Regards

Paulo

Hello Paulo,

Thanks for writing in!

Please be advised that the Post Carousel is using the fixed date code. You can only change it by modifying the post carousel. To do that, since your child theme is already set up, please add the following code in your child theme’s functions.php file

// Custom Entry Cover
// =============================================================================

if ( ! function_exists( 'x_ethos_entry_cover' ) ) :
  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"><?php echo get_the_author(); ?></span>
            <span class="entry-cover-categories"><?php echo x_ethos_post_categories(); ?></span>
            <span class="entry-cover-date"><?php echo get_the_date( 'j \d\e\ F \d\e Y' ); ?></span>
          </div>
        </a>
      </article>

    <?php }

  }
endif;

We would love to know if this has worked for you. Thank you.

Thanks a lot. Worked like a charm.

You’re always welcome!

Glad @RueNel was able to help you here.

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