• Resolved Kovah

    (@kovah)


    Hi,

    at the moment I’m pretty happy with Top 10 but one functionality is missing for me.
    Users of my site should be allowed to exclude posts from the trendings but they do not have access to the plugin settings. Is there any way to exclude posts in the widget or shortcode directly? Or maybe hook into the plugin settings and create a new field in the post edit screen or something similar?

    Thanks for your work!

    https://ww.wp.xz.cn/plugins/top-10/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ajay

    (@ajay)

    Hi,

    It’s one of the things I plan on implementing, i.e. exclusion settings per post in the metabox. I’ll need to see how I can implement it partially for admins and partially for all users. But, it’s a good idea that I’ll put on my list of things to add.

    Thread Starter Kovah

    (@kovah)

    Hmm okay but there is no way to do this without changing the plugin code, right?

    Plugin Author Ajay

    (@ajay)

    Hi,

    In theory, you could hook into the 'tptn_widget_options filter to set the option to

    Something like:

    function filter_tptn_widget_options( $arguments ) {
    
        $arguments['exclude_post_ids'] = '10,15';
    
    }
    add_filter( 'tptn_widget_options', 'filter_tptn_widget_options' );

    Where you set the 10, 15 etc. as a set of post IDs to exclude.

    If you’re using the shortcode to display the top posts, then you could pass:

    exclude_post_ids = '10,15' as one of the parameters of the shortcode.

    However, this won’t automatically allow authors to select their post not to display in the top lists. It might be more of an admin thing. Alternatively, you could code in your custom field / meta and let them select this and then use that to populate the list of post IDs that the above parameter takes.

    This is eventually what I will be implementing.

    Thread Starter Kovah

    (@kovah)

    Hell it’s that easy!
    Simply adding the exclude_post_ids="10,15" to the shortcode excluded the posts from the widget!
    MANY MANY THANKS!

    Plugin Author Ajay

    (@ajay)

    You’re welcome 🙂 The shortcode is extremely powerful, because you can pass any of the default options and it will work.

    Btw, do consider writing a review of Top 10.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Exclude posts dynamically / in shortcode?’ is closed to new replies.