How to display time when page is created and edited
How to display time when page is created and edited
How to display time when page is created and edited
How do you add Author and date Published on Category Pages?
thanks for responses, Allowed me to find correct answer which I’ve posted below – $tickets_for_user = get_posts(array( ‘post_type’ => ‘ticket’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘event_date’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 1, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘event_date’, ‘value’ => array($today,’20991231′), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘DATE’, ), array( ‘key’ => … Read more
You need something like this: $args = array( ‘post_type’ => ‘post’ ); $q = new WP_Query($args); if ($q->have_posts()) { $date=””; while ($q->have_posts()) { $q->the_post(); $m = get_post_meta($post->ID,’field_id’,true); // var_dump($m); if ($date != $m) { // if $m is a strtotime compatible string echo date(‘l’,strtotime($m)); $date = $m; } echo ‘<br>’; the_title(); echo ‘<br>’; echo str_repeat(‘-‘,200); … Read more
The best way to do this would be to set up a custom table. For each view you would add a new row which would contain (at least) a uid, the post id and the date/time. The beauty of this method is you can store as much data per view as you like, such as … Read more
Use the_date with link
Yes, you can do that using PHP. Here’s a function from @arnorhs: $time = strtotime(‘2010-04-28 17:25:43’); echo ‘event happened ‘.humanTiming($time).’ ago’; function humanTiming ($time) { $time = time() – $time; // to get the time since that moment $time = ($time<1)? 1 : $time; $tokens = array ( 31536000 => ‘year’, 2592000 => ‘month’, 604800 … Read more
You create two date objects and compare with the diff() methode. $from = new DateTime( ‘1970-01-01’ ); $to = new DateTime(‘today’); $years = $from->diff($to)->y; $months = $from->diff($to)->m; echo $years . ‘ years and ‘ . $months . ‘ months.’; => 46 years and 1 months.
I think you could simplify this a lot by using the pre_get_users hook, instead of working directly with the complicated SQL within the pre_user_query hook. Try something like: add_action( ‘pre_get_users’, function( \WP_User_Query $q ) { $qv = &$q->query_vars; if( isset( $qv[‘orderby’] ) && ‘test_date’ === $qv[‘orderby’] ) { // Custom meta query $qv[‘meta_query’] = [ … Read more
New versions of jQuery do not support the href=# selector syntax and require href=”#”syntax. Something on your site uses an deprecated syntax. Deactivate plugins/theme until you find which one is it, and contact its author’s support.