Conditionally Loading JavaScript/CSS for Shortcodes

Based on my own experience, I’ve used a combination of method 1 & 2 – the architecture and footer scripts of 1, and the ‘look-ahead’ technique of 2. For the look-ahead though, I use regex in place of stripos; personal preference, faster, and can check for ‘malformed’ shortcode; preg_match( ‘#\[ *shortcode([^\]])*\]#i’, $content ); If you’re … Read more

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