• Hello everybody:
    first great plugin. Just I looked for an option to exclude specific posts via IDs. Therefore I modified the following line in wp-postviews.php, to have a possibility to adjust the displaying in the frontend. I added the following to the SQL-Statement (see below):
    AND ID NOT IN (33, 1142, 1145)

    ###############################################
    REMARK FOR THE DEVELOPER:
    Because it is hardcoded it would be awesome if with a future update this functionality could be implemented. Another general remark would be to use WP-Hooks, so that as a developer I can easily hook the functions 😉
    ###############################################

    modification of the SQL-Statement in line 304:
    $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND ID NOT IN (33, 1142, 1145) AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");

    • This topic was modified 7 years, 5 months ago by hpd2311.
  • The topic ‘Exclude Posts IDs via Shortcode Improvement’ is closed to new replies.