WordPress.org

Support

Support » Plugins and Hacks » WordPress Popular Posts » Query, today, most viewed.

Query, today, most viewed.

  • What I will use to show most viewed today in function:

    function popular_today($atts)
    {
    extract(shortcode_atts(array(
            'slug' => '',
            'limit' => '5',
            ),$atts));
    
            //The Query
        query_posts('??What to use here??&category_name='.$slug);
            //The Loop
           if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    $return .= '<div class="posts">';
    $return .= '<div class="post-thumbnail">';
    $return .= '<a href="'.get_permalink($post->ID).'" title="">'.get_the_post_thumbnail( $post_id, 'post-thumb').'</a>';
    $return .= '</div>';
    $return .= '<div class="post-title">';
    $return .= '<a href="'.get_permalink($post->ID).'" title="">'.get_the_title().'</a>';
    $return .= '</div>';
    $return .= '</div>';
    
    endwhile;
    endif;
    
            //Reset Query
        wp_reset_query();
    return $return;
    }
    add_shortcode('popular_today', 'popular_today');

    http://wordpress.org/plugins/wordpress-popular-posts/

  • The topic ‘Query, today, most viewed.’ is closed to new replies.
Skip to toolbar