Help with hierarchical custom taxonomies and permalinks…almost there

Ok, I managed to get it working by hooking into the ‘request’ filter, then checking to see if the last segment is term or not. If it’s not, change the $request var: function alter_the_query( $request ) { $dummy_query = new WP_Query(); // the query isn’t run if we don’t pass any query vars $dummy_query->parse_query( $request … Read more

How to modify query so it grabs only 90 posts in total?

Try using paginate_links( $args ). Here is code adopted from codex. $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; $args = array( ‘posts_per_page’ => 30, ‘paged’ => $paged, ); $the_query = new WP_Query( $args ); // the loop etc goes here.. $big = 999999999; echo paginate_links( array( ‘base’ … Read more

Order posts ascending with number in title

Old answer (which no longer works): A sneaky way to do it using MySQL, assuming the number’s always at the end, is to reverse the title, convert it to a number (+0), and then reverse again and convert it to a number: function wpse174646_posts_orderby( $orderby, $query ) { if ( $query->get( ‘orderby’ ) != ‘title_number’ … Read more

How to disable the editing of the time and date published?

There is no straightforward way to do this– at least not one that I see. That is, there don’t seem to be any hooks specifically intended for this task. You still have options though. This is what I’d do: First, deny changes. function deny_post_date_change( $data, $postarr ) { unset( $data[‘post_date’] ); unset( $data[‘post_date_gmt’] ); return … Read more

WordPress query by multiple Custom fields and order by date

@Uffo I would say your args are wrong, should be something like: $args = array( ‘post_type’ => ‘Event’, ‘posts_per_page’ => 1000, ‘meta_query’=> array( array( ‘key’=>’event_informations_show_on_the_homepage’, ‘value’=> ‘Show on the homepage’, ‘compare’ => ‘==’ ) ), ‘meta_key’=>’event_informations_date’, ‘orderby’=>’meta_value_num’, ‘order’=>’ASC’ ); The way you did it, it’s just the last meta_key that will be used both for … Read more

Sorting meta_value as integer doesn’t work

It’s not the plugin that is causing the issue it is the fact you are not querying the database correctly. It is not looking for integers your value is currently being stored as a string. To fix this you need to somehow change the value to a integer before it is passed to your array.

‘paged’ in wp_query doesn’t work

You set offset param, so paged param is ignored 😉 From Codex: offset (int) – number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged If you want to ignore most recent post in this query, you can achieve it in two ways. 1. Custom pagination. $ppp = get_option(‘posts_per_page’); … Read more

Posts for next month

The Codex link already has anything you seem to be after. Maybe you just didn’t know how to use the parameters… I would do this by means of a date_query: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => array( ‘publish’, ‘future’, ), ‘date_query’ => array( array( ‘after’ => strtotime( ‘now’ ), ‘before’ => strtotime( ‘+1 … Read more