Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Michel – xiligroup dev

    (@michelwppi)

    the_time() is a without param function… In WP (and more in multilingual context) you must use wp functions as used in bundled theme like twenty fourteen. The date format (defined in general settings) will be translated if date format in current language .mo.
    M.

    Thread Starter aline.andrade

    (@alineandrade)

    I put the tool and worked to format the date.

    /*formatar a data*/
    function my_date($thedate,$theformat) {
      /* param no used because php format */
      /*return the_xili_local_time('%d %B %Y - %H:%M',strtotime(get_the_time('d/M/Y H:i')));    */
      if (the_curlang() == "pt" ) {
      		return the_xili_local_time('%d ' . de . ' %B ' . de . ' %Y',strtotime(get_the_time('d/M/Y')));
      } else {
    	   return the_xili_local_time('%d' . th . ' %B %Y',strtotime(get_the_time('d/M/Y')));
      }
    }
    add_filter('the_date','my_date',10,2);

    Now how do I format the date of a custom field
    <p class="data"><?php the_field('data-evento'); ?></p>

    Thread Starter aline.andrade

    (@alineandrade)

    It returns the month in English and weekday in Portuguese.
    I want him back
    Tue 24 Aug
    and
    24 Agos ter

    <?php $recent = new WP_Query("cat=28&showposts=5&lang=en"); while($recent->have_posts()) : $recent->the_post();?>
    <p class="data"><?php the_field('data-evento'); ?></p>
    <?php endwhile; ?>

    and

    <?php $recent = new WP_Query("cat=28&showposts=5&lang=pt"); while($recent->have_posts()) : $recent->the_post();?>
    <p class="data"><?php the_field('data-evento'); ?></p>
    <?php endwhile; ?>
    Plugin Author Michel – xiligroup dev

    (@michelwppi)

    Tha date formatting depends of the language of the current web page if gettext method/functions are used…
    To save “formatted” datas in custom fields, you must use customized format (and library) used in specific functions.
    To go deeper, this forum is not totally the right place.
    M.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘dates’ is closed to new replies.