Shortcode for latest -not expired- posts

Thanks, i got it now; indeed with meta_query. function my_recent_posts_shortcode( $atts ) { global $post; $currenttime = current_time(“mysql”); $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ => ‘newsbox-date’, ‘value’ => $currenttime, ‘compare’ => ‘>’ ) ) ); $newsbox = new WP_Query( $args ); if ( $newsbox->have_posts() ) : $list=”<div class=”newsbox-posts”>”; while ( … Read more

Taxonomy and Date in same query?

Take a closer look at the date parameters; you’ll need to enter an integer (number), not a string (text). Simply get rid of the single quotes to make it work: $args = array( ‘post_type’ => ‘job’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘location’, ‘terms’ => ‘dallas’, ‘field’ => ‘slug’ ) ), ‘date_query’ => array( array( … Read more

Use the same date-based permalink structure for all post types

You’ll need to add the year, month, and day portions to the post’s permalink in your post_link callback: $link = str_replace( “https://wordpress.stackexchange.com/” . $pto->rewrite[ ‘slug’ ] . “https://wordpress.stackexchange.com/”, “https://wordpress.stackexchange.com/” . get_the_time( ‘Y/m/d’, $post ) . “https://wordpress.stackexchange.com/”, $link ); This will return a permalink such as example.com/2014/07/02/post-name. You’ll have to adjust the logic in your pre_get_posts … Read more

Only showing the_date and the_excerpt for first entry in get_posts

I think you are having same issue as I was having earlier. In this question. So here is the fixed code. This should work. I replaced both of these functions with get_the_date and get_the_excerpt. For the detailed explanation why/why not this work, read @kaiser’s answer in same question. <?php $args = array( ‘posts_per_page’ => 5, … Read more