If modified on same day, show only time

Give this a try: if(get_the_modified_date(‘zY’)==date(‘zY’)) { the_modified_date(‘g:i a’); } else { the_modified_date(‘F j, Y’); echo ‘ at ‘; the_modified_date(‘g:i a’); } It checks that the modified date is the current day. If it is, it only displays the modified time. Otherwise it displays both the date and time.

Automatically Updating Publish Date Bug

You could also hook into the save_{$post_type} action, which fires only when a certain post type is updated. This hook passes to post’s ID to the callback function: add_action( ‘save_post’, ‘my_callback_function’ ); function my_callback_function( $post_id ){ if ( ! wp_is_post_revision( $post_id ) ){ // Unhook this function so it doesn’t loop infinitely remove_action(‘save_post’, ‘my_callback_function’); // … Read more

Displaying the Month and Year that a page was Created?

This worked for me. I created variables for both the month of the post and the year of the post. <?php $post_month = get_the_time(‘F’); $post_year = get_the_time(‘Y’); if ( is_page(‘about/mission-statement/’)) { echo ‘<time>’ . $post_month . ‘ ‘ . $post_year . ‘:’ . ‘</time>’; } ?>

display month in french in wordpress/php?

there is a custom function in wordpress called date_i18n. so basically you do echo date_i18n( ‘H:i d-m-Y’, $ts ); without the setLocale stuff.. find the function date_i18n and its parameters here. you could even build in your translation all in there, without the language check before: date_i18n( __( ‘H:i d-m-Y’, ‘textdomain’ ) ); (replace ‘textdomain’ … Read more

How to render a time-of-day string like ’16:42′ with a site’s chosen time format?

The trick here is using wp_date() in a peculiar way, giving it the time of day in seconds (as if it were 1970-01-01 16:42:18), then asking for it to be formatted in UTC. $time=”16:42:18″; if ( preg_match( ‘/^\d\d:\d\d:\d\d$/’, $time ) ) { //validate the $time $ts = intval( substr( $time, 0, 2 ) ) * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)