Show different time stamp based on time

Check out human_time_diff(): if ( DAY_IN_SECONDS < ( $time = current_time( ‘timestamp’ ) ) – ( $time_post = get_the_time( ‘U’ ) ) ) echo human_time_diff( $time_post, $time ) . ‘ ago’; else the_time( ‘F j, Y at g:i a’ ); DAY_IN_SECONDS is a handy “helper” constant in WordPress, along with: MINUTE_IN_SECONDS HOUR_IN_SECONDS WEEK_IN_SECONDS YEAR_IN_SECONDS

Retrieving posts by their date and category

Please try the following code: Following code has to be added in shortcode function global $wpdb; $start .= $attr[‘godina’] . “-09-01”; $end .= $attr[‘godina’] + 1 . “-08-31”; $cat = $attr[‘cat’]; //$cat must be category name. $cat_term_id=get_term_by(‘name’, $cat, ‘category’); $term_id=$cat_term_id->term_id; $query = array( ‘post_type’ => ‘post’, ‘tax_query’ => array(array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, … Read more

Remove Page Timestamp via functions.php so it doesn’t show in Google Search Result Description [closed]

It depends on what the template uses to output whatever you’re trying to remove. If you look in source at whatever function is outputting what you want to remove, they each have a filter to let you modify output where you can __return_false instead, however, if there’s text or markup surrounding those template tags, your … Read more

How to show list of posts with custom field value (a date) that are coming soon

Firstly, the_post() doesn’t actually output anything – it just sets up the post data ready to output. You’ll need to do something like this to show the posts: <?php while ( $loop->have_posts() ) : $loop->the_post(); the_title(); the_content(); endwhile; ?> There’s several more tags you can use and you’ll want to format the HTML around them … Read more

Limit loop to future events

Assuming your date is in the correct format for proper ordering (yyyy-mm-dd), add a meta_query to your args: $args = array( ‘post_type’ => array(‘basic_events’), ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘date_of_event’, ‘paged’ => $paged, ‘meta_query’ => array( array( ‘key’ => ‘date_of_event’, ‘value’ => date( ‘Y-m-d’, current_time( ‘timestamp’ ) ), ‘compare’ => ‘>’, ‘type’ … Read more

How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]

I voted to close your question, because it is pretty much a PHP problem, not a WordPress one and thus off topic on here. Nonetheless here comes some help. General information about Formatting Date and Time from the WordPress codex you might find helpful. Aside from that, on the PHP side of things, the date … Read more

How to display a WordPress Custom Field only on a specific day of the week?

You are not checking the current date correctly. You need to use current_time() funciton to get current datetime according to WordPress configuration. Then, using PHP date() you can check what day of week current date is: // Get current date time of WordPress in Unix timestamp format $timestamp = current_time( ‘timestamp’ ); // Get day … Read more