andrains
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Reaction Buttons] Widget: Limit posts to past weekI achieved it by creating a separate widget plugin using wp_query instead of wpdb.
Seemed easier than editing the existing plugin and breaking updatability in the future.The gist of it is:
<ul> <?php global $post; $args = array( 'numberposts' => $dis_posts, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ), 'date_query' => array( array( 'after' => '4 week ago' ) ), 'meta_key' => '_reaction_buttons_0', 'orderby' => 'meta_value_num', 'order' => 'DESC' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class='topBull'> <div class='topBullImage'> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(array(100,100));?></a> </div> <div class='topBullTitle'> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a> <br> <span class='topBullCount'><?php echo get_post_meta($post->ID, '_reaction_buttons_0', 'meta_value_num'); ?> </span> </div> </li> <?php endforeach; ?> </ul>
Viewing 1 replies (of 1 total)