WordPress.org

Forums

WordPress Popular Posts
Query, today, most viewed. (1 post)

  1. LapanWebsite
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Popular Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.