Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // changed epanel/widget-tabbed.php file in ElegantThemes.com DelicateNews theme
- //to use Jetpack stats via the WordPress.com Popular Posts plugin to retrieve popular posts (instead of comments)
- <ul>
- <?php if (function_exists('WPPP_show_popular_posts')) { //Relies on WordPress.com Popular Posts plugin
- WPPP_show_popular_posts( "title=&list_tag=none&number=".$popularPostsNumber."&thumbnail_size=59&format=<li><a href='%post_permalink%' title='%post_title_attribute%' class='clearfix'><span class='box'><span class='overlay'></span>%post_thumbnail%</span><span class='title'>%post_title% (%post_views% views)</span></a></li>" );
- /* Optionally you can add some parameters to the function, in this format:
- * name=value&name=value etc.
- *
- * Possible names are:
- * - title (title of the widget, you can add tags (e.g. <h3>Popular Posts</h3>) default: Popular Posts)
- * - number (number of links shown, default: 5)
- * - days (length of the time frame of the stats, default 0, i.e. infinite)
- * - show (can be: both, posts, pages, default both)
- * - format (the format of the links shown, default: <a href='%post_permalink%' title='%post_title%'>%post_title%</a>)
- * - time_format (the format used with %post_time%, see http://codex.wordpress.org/Formatting_Date_and_Time)
- * - thumbnail_size (the width/height in pixels of the post's thumbnail image)
- * - excerpt_length (the length of the excerpt, if %post_excerpt% is used in the format)
- * - title_length (the length of the title links, default 0, i.e. unlimited)
- * - exclude (the list of post/page IDs to exclude, separated by commas)
- * - exclude_author (the list of authors IDs to exclude, separated by commas)
- * - cutoff (don't show posts/pages with a view count under this number, default 0, i.e. unlimited)
- * - list_tag (can be: ul, ol, none, default ul)
- * - category (the ID of the category, see FAQ for info. Default 0, i.e. all categories)
- * - cachename (it is used to enable the cache. Please see the FAQ)
- * - cache_only_when_visitor (if enabled, it doesn't serve a cached version of the popular posts to the users logged in, default 0)
- * - magic_number (set it to a number greater than 1 if you see less links than expected)
- *
- * Example: if you want to show the widget without any title, the 3 most viewed
- * articles, in the last week, and in this format: My Article (123 views)
- * you will use this:
- * WPPP_show_popular_posts( "title=&number=3&days=7&format=<a href='%post_permalink%' title='%post_title_attribute%'>%post_title% (%post_views% views)</a>" );
- *
- * You don't have to fill every field, you can insert only the values you
- * want to change from default values.
- *
- * You can use these special markers in the `format` value:
- * %post_permalink% the link to the post
- * %post_title% the title the post
- * %post_title_attribute% the title of the post; use this in attributes, e.g. <a title='%post_title_attribute%'
- * %post_views% number of views
- * %post_thumbnail% the thumbnail image of the post.
- * %post_excerpt% the first n characters of the content. Set n with excerpt_length.
- * %post_category% the category of the post
- * %post_comments% the number of comments a post has
- * %post_time% the date/time of the post. You can set the format with time_format.
- * %post_author% the author of the post.
- */
- } else { ?>
- <?php global $wpdb;
- $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $popularPostsNumber");
- foreach ($result as $post) {
- #setup_postdata($post);
- $postid = $post->ID;
- $title = $post->post_title;
- $commentcount = $post->comment_count;
- if ($commentcount != 0) { ?>
- <?php query_posts("p=$postid"); ?>
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <?php get_template_part('includes/fromblog_post'); ?>
- <?php endwhile; endif; wp_reset_query(); ?>
- <?php };
- };?>
- <?php } ?>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement