Why does my URL keep returning 404 error code?

Here is the solution of my problem, thanks to @Milo: function wpa_date_archive_post_types( $query ){ if( $query->is_main_query() && $query->is_date() ): $query->set( ‘post_type’ , array( ‘movie’ ) ); $query->set( ‘year’ , 0 ); $query->set( ‘tag’ , ‘1994’ ); $query->set( ‘post_status’ , array( ‘publish’ ) ); endif; } add_action( ‘pre_get_posts’, ‘wpa_date_archive_post_types’ );

Getting an extra post’s meta data?

You are building your array and iterating over it at each iteration of the outer Loop. Think about what happens. First iteration of the outer loop $get_year becomes array(‘2012’) and you iterate over it echoing “2012”. Second iteration $get_year becomes array(‘2012′,2013’) and you iterate over it echoing “2012” and “2013”. Do you see what happened? … Read more

How to rearrange a pool of posts joined using two queries?

This is how I would approach it: Code function my_pseudo_date_query( $where, $query ) { global $wpdb; $dq = $query->get(‘my_date_query’); if( $dq && !empty( $dq[‘after’] ) ){ $where .= $wpdb->prepare( ” AND {$wpdb->posts}.post_date >= %s” $dq[‘after’] ); } if( $dq && !empty( $dq[‘before’] ) ){ $where .= $wpdb->prepare( ” AND {$wpdb->posts}.post_date <= %s”, $dq[‘before’] ); } … Read more

How to display date of blog creation

Actually it is possible if the first user account exists (with user id 1). Then you can use – <?php echo mysql2date(‘Y’, get_user_option(‘user_registered’, 1) ); ?> The concept behind this is, when a WordPress Blog Installed, one user account created, and we are using his/her registration time.

Date is wrong on ‘all posts’ page

It could be because you are not supplying post id in time parameter function. In place of the_time(‘d F’) try using echo get_the_time(‘d F’m $post->ID) because it will give you the flexibility to supply post id when you are in a loop. Reference: get_the_time Codex EDIT My bad, I guess $post variables are not being … Read more

Using php inside javascript [closed]

If you want to re-instantiate your countdown timer only after the date has been changed and saved, then, something to the effect of: //In your custom.js file…. //make sure your localized data is a dependency of your custom.js file so you have proper scope to local data jQuery(document).ready(function($){ var date, gapinvite; date = $(‘input[name=”director_date”]’); if … Read more

Using WP meta query to show custom post types by a start and finish date

The query will by default GROUP BY the post ID, meaning that a post will only appear once in the list. You can remove that GROUP BY pretty easily with a filter: add_filter(‘posts_groupby’,’__return_empty_string’); $events = new WP_Query($args); remove_filter(‘posts_groupby’,’__return_empty_string’); That might get you what you want. It is a bit hard to tell. Without the GROUP … Read more

Ordering custom posts by meta field date

You are not querying/saving the correct meta_key. For example, looking at your code, you pass $typename variable to update_post_meta() as meta_key and $typename=”events”. But later in the query you are querying for meta_key = date. Also, you pass $meta as meta_value and in your actual code $meta is an array containing multiple values (location, date, … Read more