• Resolved indyparker

    (@indyparker)


    Hi Hector,

    I have been using your plugin for many years now with a modification required to exclude posts, as follows in the wordpress-popular-posts.php file:

    // * authors
    			if ( !empty($instance['author']) ) {
    				$authors = explode(",", $instance['author']);
    				$len = count($authors);
    
    				if ($len > 1) { // we are getting posts from more that one author
    					$where .= " AND p.post_author IN(".$instance['author'].") ";
    				} else if ($len == 1) { // post from one author only
    					$where .= " AND p.post_author = '".$instance['author']."' ";
    				}
    			}
    
    // Excludes *************
    			$exclude_posts = " p.ID NOT IN (2701,3009,5655,8309,10668,14666,19200,24435,26342,27018,28605,30181,31378,31744,29595,31248,33349,33574,28612,32547,30217,28457,28056,25919,27496,26809,35044,34002,34264,34086,34825,14471,19505,21143, 22571,33959,6558,29875,2331,4196,3528,3009,363,36693,33454,34856,35256,35774,36426,35994,37579,38209,38456,38796,38722,40324,40628,42141,42547,41827,41836,41340,43258,45319,44967,47990,48163,48549,48752,49262,48543,49683,50204,50769,51840,52937,54489,57595,57935) ";
    
    			$query = "SELECT p.ID AS 'id', p.post_title AS 'title', p.post_date AS 'date', p.post_author AS 'uid' {$fields} FROM {$wpdb->posts} p {$join} WHERE" . $exclude_posts . "AND p.post_status = 'publish' AND p.post_password = '' {$where} GROUP BY p.ID {$having} ORDER BY {$orderby} DESC LIMIT " . $instance['limit'] . ";";
    
    			//echo $query;
    			//return $content;
    
    			$mostpopular = $wpdb->get_results($query);

    I want to upgrade to your latest plugin for efficiency and security but still need to have he ability exclude the posts as shown above.

    Can you please help as to how I can do this? Is is possible I add a special function in functions.php or add this code in the current version, if so where?

    Your help with this is highly appreciated.

    Thanks
    Indy

    https://www.ads-software.com/plugins/wordpress-popular-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Indy!

    Wow, you must be using a really old version of the plugin hehe. The ability to exclude posts by ID has been available since version 2.3.3. Current version -at the time of writing this- is 3.2.2.

    A couple of things you should know / do:

    • The current version of WPP requires at least WordPress 2.8. If you’re running an older version of WordPress, consider upgrading it first.
    • It’s always a good idea to back up before making any major changes to your site. This of course includes backing up your database as well.
    • While I believe that upgrading from whatever version you have now to the latest version should be fine, chances are that some things might break during the process. After all, there has been quite a few changes over the past few years and I can’t guarantee that everything will go smoothly. Hopefully, you won’t have any problems at all ?? (but if you do, let me know and I’ll do my best to give you a hand)
    Thread Starter indyparker

    (@indyparker)

    Hi Hector,

    Thanks for your reply.

    I have updated to the latest version and it seems to be working fine. If I have any problems I will be in touch.

    Indi

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issues with upgrade to 3.2.2’ is closed to new replies.