• Hello everybody:
    first great plugin. Just I looked for an option to exclude specific posts via IDs. Therfore I modified the following lines in thumbs-rating.php, to have a possibility to adjust the displaying in the frontend. This can be achieved by adding (for instance) the following into the shortcode invocation:
    exclude_posts=”4,8,15,16,23,42″

    I added the array for the default values:
    'exclude_posts' => [4,8,15,16,23,42],

    and added the argument:
    'post__not_in' => explode(",", $exclude_posts),

    ###############################################
    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 ??
    ###############################################

    default values in line 340:

    extract( shortcode_atts( array(
    			'exclude_posts' => [4,8,15,16,23,42],
    			'type' => 'positive',
    			'posts_per_page' => 5,
    			'category' => '',
    			'show_votes' => 'yes',
    			'post_type' => 'any',
    			'show_both' => 'no',
    			'order' => 'DESC'
    		), $atts ) );

    added ‘exclude_posts’ to arguments in line 367:

     $args = array (
    	    	'post__not_in'			=> explode(",", $exclude_posts),
    	    	'post_type'				=> $post_type,
    			'post_status'			=> 'publish',
    			'cat'					=> $category,
    			'pagination'			=> false,
    			'posts_per_page'		=> $posts_per_page,
    			'cache_results'			=> true,
    			'meta_key'				=> $meta_key,
    			'order'					=> $order,
    			'orderby'				=> 'meta_value_num',
    			'ignore_sticky_posts'	=> true
    		);

    • This topic was modified 8 years, 1 month ago by hpd2311.
Viewing 1 replies (of 1 total)
  • Plugin Author Ricard Torres

    (@quicoto)

    Hello,

    I have released the 3.2 version with your code update. Thank you!

    Regarding the hooks, I am afraid I don’t know how to do that.

    Please test the new version and let me know if it works as expected.

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude Posts IDs via Shortcode Improvement’ is closed to new replies.