• jxxst

    (@jxxst)


    I would like to list some posts from a category calles “Top10” in my sidebar. These are automatically imported each day and should not be displayed in the “normal” front page loop. However, when I try all the plugins available they remove the posts not from the normal loop but also from my “custom loop”. Is their any way to override the setting in the plugin?

    Any help is appreciated!

    https://www.ads-software.com/extend/plugins/ultimate-category-excluder/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael Clark

    (@planetmike)

    How are you adding the “Top10” category to your sidebar? You may be able to hard code a WordPress query into the sidebar to generate the listing. Read through this page https://www.kimwoodbridge.com/wordpress-how-to-list-recent-posts-from-one-category/ for tips on how to get started. I don’t know if this will conflict with UCE or other category management plugins. I hope this helps. Mike

    Alexander Kops

    (@alexander-kops)

    I have the same problem. I solved it by altering the ksuce_exclude_categories-function to preserve the “category__not_in” settings in the query, if there are any, and just add the blocked ones:

    function ksuce_exclude_categories($query) {
        $options = ksuce_get_options();
        //Mod: Do not override existing excluded categories
        $categories = $query->get('category__not_in');
        $array2 = empty($categories) ? array() : $categories;
        if ($query->is_home) {
            foreach ($options['exclude_main'] as $value) {
                $array2[] = $value;
            }
        }
        if ($query->is_feed) {
            foreach ($options['exclude_feed'] as $value) {
                $array2[] = $value;
            }
        }
        if ($query->is_archive) {
            if (!is_admin()) {
                foreach ($options['exclude_archives'] as $value) {
                    $array2[] = $value;
                }
            }
        }
        $query->set('category__not_in', array_unique($array2));
        //Mod end
        return $query;
    }

    So now when you use
    query_posts(array('category__not_in' => array(1,2,3));
    and have blocked the category ids 3,4,5 with the plugin, it will ultimately block categories 1,2,3,4,5

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Ultimate Category Excluder] Overriding’ is closed to new replies.