• Resolved inventiveweb

    (@inventiveweb)


    Could you point us in the right direction to change the date format when using the shortcode option “displaydate”? We have a client that wants to hide the day but keep month and year visible.

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor richardgabriel

    (@richardgabriel)

    Hello!

    Unfortunately, we do not have a way to optionally control the date format, at this time.

    I could point you in the right direction of where to edit the PHP file to change the date, but (believe it or not) you’re the first person I’ve seen ask about the date formatting (it could be everyone else is just quiet.)

    I think making this formatting controllable via an option is a good idea and we’ll be sure to add it to our work list.

    In the meantime, the only way to accomplish this is by editing a plugin file – unfortunately, that will have to be redone after each plugin update (as the update will overwrite your change.)

    All the best,
    Richard

    Thread Starter inventiveweb

    (@inventiveweb)

    Thanks for the quick reply Richard.

    If you could point us to the right file, that would give us a bit of a head start ??

    We tried changing the date format within the core WordPress settings to see if your plugin follows that. Not sure if it would be easier and/or make more sense to follow that setting instead of creating another variable?

    Best regards,

    Howard

    I’m still interested in date-format localization.
    I found in include/lib/ik-custom-post-type.php, line 264 and 265:

    // translators: Publish box date format, see https://php.net/date
    date_i18n( __( 'M j, Y @ G:i', $textdomain ), strtotime( $post->post_date ) )
    

    But translating this in my localized PO-file didn’t work. That’s very unfortunate as almost anything in WP can be localized nowadays.

    stu
    (WP polyglot and translator nl_NL)

    • This reply was modified 7 years, 9 months ago by Sjoerd Blom.
    Plugin Contributor richardgabriel

    (@richardgabriel)

    Hey Sjoerd!

    I believe the date in question is the Testimonial Date, which is seperate from the publication date in this particular scenario.

    I believe you want to edit line ~635 in gp-testimonial.class.php:

    $testimonial['date'] = get_the_date('M. j, Y', $postid);

    Alter get_the_date to match the format you want and you should be all set.

    Please note that, at this time, you’ll have to perform this each time.

    Alternatively, you can use the ‘easy_t_get_single_testimonial_html’ filter to alter the display of the content from within your theme’s functions.php file. The documentation on this is sparse at the moment but I could try and walk you through it, if you’d like.

    All the best,
    Richard

    Richard,

    Thanks! I will go into that after the weekend.

    stu

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change date format’ is closed to new replies.