Meta query stopped working
should ‘type’ => ‘CHAR’ actually be ‘type’ => ‘DATE’ the Codex might help on the possible parameters you need here
should ‘type’ => ‘CHAR’ actually be ‘type’ => ‘DATE’ the Codex might help on the possible parameters you need here
This is completely untested, but the principles are in place. Get today’s date and built the title, build the slug and then insert the post as a draft. This doesn’t take care of disabling the title field from being edited. I imagine what you’re looking for would be a Javascript solution that just looks for … Read more
You can do that with a custom SQL query, something along the lines of: global $wpdb; $results = $wpdb->get_results( “SELECT DATE(post_date) AS d, COUNT(*) AS c FROM $wpdb->posts WHERE post_status=”publish” GROUP BY d” ); You’ll get an array of objects where d is the date and c is the number of posts published on that … Read more
I don’t know if this can be accomplished with WP alone. I would create two custom fields for your posts. First custom field would hold the date you want make the switch Second field would hold the category you want the post to switch to (Assuming it’s not always the same post and not always … Read more
I believe this is correct: $year = 2013; $month = 0; $qry = new WP_Query( array( ‘post_type’=>’post’, ‘posts_per_page’=>-1, ‘orderby’=>’date’, ‘order’=>’ASC’, ‘ignore_sticky_posts’ => true, ‘year’ => $year, ) ); while ($month < 12) { $month++; echo date(‘M’,strtotime(‘2000-‘.str_pad($month, 2, ‘0’, STR_PAD_LEFT).’-01 00:00:01′)).'<br>’; if ($qry->have_posts()) { while ($qry->have_posts()) { if (date(‘n’,strtotime($qry->post->post_date)) == $month) { echo ” — “; … Read more
You can hook into the action the_post (you get the post as parameter here) and run wp_update_post(). Make sure to clean up the date properties and not to run on the admin side or when a post is called in a widget: is_admin() or add_action( ‘the_post’, function( $post ) { if ( ! is_singular() or … Read more
For creating a date filter you can use // Create a new filtering function that will add our where clause to the query function filter_where( $where=”” ) { // posts in the last 7 days $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘-7 days’)) . “‘”; return $where; } add_filter( ‘posts_where’, ‘filter_where’ ); … Read more
Conceptually, that isn’t hard to do. if (have_posts()) { while (have_posts()) { the_post(); if ( $post->post_date >= date(“Y-m-d H:i:s”,strtotime(‘7/15/03 1:03 PM’)) && $post->post_date <= date(“Y-m-d H:i:s”,strtotime(‘9/19/07 11:34 AM’))) ) { // (layout coding) } elseif ( /* another condition */ ) { // (layout coding) } elseif ( /* another condition */ ) { // … Read more
Did you go to Settings >> General and set the correct offset for your timezone? To get the date: <?php $date = get_the_time(‘dmY’, $post->ID); ?> To print the date: <?php the_date(‘dmY’); ?> Both need to be within the Loop!
You can just add some settings to the permalinks: Go to: Settings->Permalinks If you want the url like this: http://example.com/category/2012/12/30/post-name Add: /%category%/%year%/%monthnum%/%day%/%postname%/ Read more here