Articles of date time

Incorrect ordering of custom post type based on time

I have a custom post type as event which accept Custom fields’ values as gp_event_date as ( 2015/02/26) gp_event_time as (SIMILAR) to 08:00PM – 10:00PM format. And on the list page, it orders the display of post according to this date and time combination. But somehow the order is not proper, as it is not […]

date() returns incorrect value if used from WordPress theme, but correct otherwise

As I have mentioned in title if I use date(‘H’) function in WP theme, it simply returns UTC time, but the server is set to use timezone Europe/Riga and the same is set in WP General settings. At the same time if I use the same function in empty PHP test file it returns correctly […]

How to get its meta_value of a specific meta_key within wp_usermeta

Using the S2member plugin, a meta_key for the last-payment-time is automatically stored in WordPress DB under table wp_usermeta (custom field is called wp_meds2member_last_payment_time). From wp_usermeta, the column called meta_key has a value ‘wp_meds2member_last_payment_time’. But the content I’m trying to collect is its meta_value equivalent. I didn’t find how to call this meta_value to the function […]

How to show Published date and/or Modified date

My code is based on the underscores reference theme. I have a posted_on function as follows: function example_posted_on() { $time_string = ‘<time class=”entry-date published updated” datetime=”%1$s”>%2$s</time>’; if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) { $time_string = ‘<time class=”entry-date published” datetime=”%1$s”>%2$s</time><time class=”updated” datetime=”%3$s”>%4$s</time>’; } $time_string = sprintf( $time_string, esc_attr( get_the_date( ‘c’ ) ), […]

How to show different timestamp

I would like to show published time “Posted 4:15pm” for the first 24 hours, after 24hours show full published date and time “September 27, 2016 at 4:15pm” Any suggestions? Thanks in advance

Translate current_time

I have current_time in theme and it displays date like: THURSDAY, NOVEMBER 10, 2016. But I need to translate it to Persian. How can I do this?

Shortcode function doesnt work without caption

I’m working on a site that has this function to output the caption of a picture and is credits/date but doesn’t work if only credits/date are definied and caption isnt. If thats the case the function will ignore the image and it wil be wrapped in a p tag which i think its generated by […]

Sort a custom post with ACF: Date Picker & Display Featured!

Hello I have a custom post type event and i have two custom fields: event_date event_type I want to display all my events which has event_type = Featured and sorting should be by event_date in DESC order.. I have searched everywhere on SOF but unable to find any working solution.. Here is my code right […]

How to setup language of a date in a plugin

I am working on a WordPress theme using a template to manage sports team, matches, players, etc. I settled my local wordpress time in French. In the blog part, no problem the post are displaying date in French. But there is a all part with custom post types managed by a plugin. The dates displayed […]

How to call the_time current?

I’m using the_time function to print the current date on my site. The problem is, that it’s returning post or page creation times on pages other than the front page. Can I force it to print the current time on all views?