Using WP_Query to re-query and sort results using a date?

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

Sorting of coupons in the right way

Note that this part: ‘post_status’ => ‘published’, should be: ‘post_status’ => ‘publish’, You can then try the following: $args = array( ‘post_type’ => ‘gutschein’, ‘pagination’ => true, ‘posts_per_page’ => ’10’, ‘posts_per_archive_page’ => ’10’, ‘ignore_sticky_posts’ => false, ‘post_status’ => ‘publish’, ‘paged’ => $paged, ‘meta_key’ => ‘unixendet’, ); add_filter( ‘posts_orderby’, ’emti_orderby’ ); $q = new WP_Query( $args … Read more

Query post category & remove any post id

If you are trying to omit posts 1,3,5 from category 3 on your blog, you can use the following code $query = new WP_Query( array(‘cat’ => 3, ‘post_type’ => ‘post’, ‘post__not_in’ => array(1,3,5) ) ); The query results will not show posts with ids 1,3,5 of category 3.

How to query post into a complex slider

I figured it out <?php $args = array( ‘post_type’ => array(‘post’, ‘music-videos’), ‘posts_per_page’ => 5, ‘orderby’ => ‘menu_order post_date’, ); $loop = new WP_Query( $args ); ?> <div id=”example1″ class=”slider-pro”> <div class=”sp-slides”> <div class=”sp-thumbnails” > <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class=”sp-slide”> <div class=”sp-image”> <a href=”https://wordpress.stackexchange.com/questions/181352/<?php the_permalink() ?>” title=”<?php the_title_attribute(); ?>”> <?php … Read more

How can I display a number to represent the order of post?

The global $wp_query (in this case its the $query var) holds the $current_post which is available in the loop and tells the index of the current post ( $wp_query->current_post ). The $wp_query->post_count tells the number of posts being displayed in the loop, and this actually becomes a simple arithmetic solution that will work no matter … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)