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

How to filter by date & a specific custom post type post-WP 4.4?

There is no logical explanation why if( is_post_type_archive(‘news) && is_date()) should fail and not work in your situation. is_date() return true on all date archives is_post_type_archive( ‘news’ ) will return true on post type archives When you visit localhost/2016/02/?post_type=news, both of those ring true, and they will only ring true on that specific URL If … Read more

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