Support » Plugin: Conditional Menus » Updated, but still no support for custom taxonomies

  • So, the plugin finally got an update (several years later). But did they fix the bug with custom taxonomies? – No…

    At least I can be happy about them not updating the plugin too often. For every update I have to fix their broken plugin again.

    Please Themify, if you ever read this, see my other post on this subject. I have a (partial) fix for this plugin which would help a lot of users wanting to use custom taxonomies to control the menus.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Custom taxonomies was the entire reason I wanted to use this plugin. It would be great to have this fixed.

    Ian Sterne

    (@ian-sterne)

    Tomas,

    I hope you are following this tread.

    Did you update the latest version of the plugin with custom taxonomy support. If so would you like to share it?

    It would seam that the author has little interest in adding support.

    Thread Starter Tomas Eklund

    (@tomas-eklund)

    I must admit that I hadn’t noticed that there was any recent updates. I’m not responsible for maintaining the site where the plugin was used and haven’t used the plugin since. I took a quick look at the current 1.1.3 version and compared it to the 1.1.0 version which my mod is based on. The code seems to be heavily reworked and I’m afraid I don’t have the time right now to implement the change and test if it still works. If you are comfortable editing PHP you may try it yourself.

    You need to edit the init.php file starting on line 318. Code below. I’m including some context, starting from line 304, so you can see where I put my code.

    
    } else { // let's dig deeper into more specific visibility rules
        if( ! empty( $logic['tax'] ) ) {
            if(is_singular()){
                if(isset($logic['tax']['category_single']) && !empty($logic['tax']['category_single'])){
                    $cat = get_the_category();
                    if(!empty($cat)){
                        foreach($cat as $c){
                            if($c->taxonomy === 'category' && isset($logic['tax']['category_single'][$c->slug])){
                                $visible = true;
                                break;
                            }
                        }
                    }
                }
                // ------------------------------------------------
                // Test for custom taxonomies
                // added by Tomas Eklund, Daladatorer on 2017-07-03
                $post_taxonomies = get_post_taxonomies(get_the_ID());
                foreach ($post_taxonomies as $post_taxonomy_name) {
                    if (isset($logic['tax'][$post_taxonomy_name])) {
                        $logic_term_slug = array_keys($logic['tax'][$post_taxonomy_name])[0];
                        $post_terms = get_the_terms(get_the_ID(), $post_taxonomy_name);
                        if ($post_terms) foreach ($post_terms as $post_term) {
                            if ($post_term->slug === $logic_term_slug) {
                                $visible = true;
                            }
                        }
                    }
                }
                // End of test for custom taxonomies
                // ------------------------------------------------
            } else {
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Updated, but still no support for custom taxonomies’ is closed to new replies.