WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Advanced Access Manager] Parent categories without posts are not showin

[Plugin: Advanced Access Manager] Parent categories without posts are not showin

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi ElwoodP,
    This is a standard WordPress behavior. You should have atleast one post to list a category. I’m using functions that WordPress core offers.

    Regards,
    Vasyl

    Thanks Vasyl. I’m very new to WordPress so might get this wrong! – If you are using something like “get_terms” function can you not just set “hide_empty” argument to 0?

    Jus doesn’t seem to make sense to exclude categories with no posts in this instance (especially when they could have children with posts).

    Great plugin by the way. I tried a few similar plugins but found Access Manager by far the best solution for me. Seems powerful yet easy to use. Perfect combination!

    This seems to work…

    private function build_categories($post_type, $taxonomy = FALSE, $parent = 0) {
    
            $tree = array();
    
            if ($parent) {
                //$taxonomy = $this->get_taxonomy_get_term($parent);
                //firstly render the list of sub categories
                $cat_list = get_terms($taxonomy, array('get' => 'all', 'parent' => $parent, 'hide_empty' => 0));
                if (is_array($cat_list)) {
                    foreach ($cat_list as $category) {
                        $tree[] = $this->build_category($category);
                    }
                }
            } else {
                $taxonomies = get_object_taxonomies($post_type);
                foreach ($taxonomies as $taxonomy) {
                    if (is_taxonomy_hierarchical($taxonomy)) {
                        $term_list = get_terms($taxonomy, array('parent' => $parent, 'hide_empty' => 0));
                        if (is_array($term_list)) {
                            foreach ($term_list as $term) {
                                $tree[] = $this->build_category($term);
                            }
                        }
                    }
                }
            }

    ElwoodP,
    Thanks for code. Looks like I didn’t pay much attention on that issue. I’ll check the solution and include it in next release.
    Regards,
    Vasyl

    This is a really important feature for me and has been the main difficulty I’ve had with your plugin, which otherwise has a lot of great features! Thanks for offering it to the community and I’d really appreciate this enhancement as soon as you include it!

    Hi jdm,
    I implemented this fix in release 1.6.5. Now it is under testing and if everything will be ok, it’ll come out of oven on Sunday 6th.

    Regards,
    Vasyl

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Advanced Access Manager] Parent categories without posts are not showin’ is closed to new replies.
Skip to toolbar