• I built a website for a client that has two distinct areas of the site. Each “side” of the side needs its own menu of pages within that part of the site. If-menu was just the thing and has been working fine to show one menu for each side. That is until a day or two ago. It may have been until yesterday when I made a simple change to the menu by deleting one item. However, nothing about my custom conditions changed on the remaining menu. But now the site is showing the same menu on both of the sections of the site. Last year, I added the following to the theme’s functions.php file, based on an internet article. And it has worked just fine until now. What happened? Why won’t it work anymore? This is a critical issue for the site in question.

    ?????
    add_filter( ‘if_menu_conditions’, ‘wpb_new_menu_conditions’ );

    function wpb_new_menu_conditions( $conditions ) {
    $conditions[] = array(
    ‘name’ => ‘Is a Get Help Page’, // name of the condition
    ‘condition’ => function($item) { // callback – must return TRUE or FALSE
    return is_page( array( 77, 196, 224, 372, 382, 389 ) );
    }
    );

    return $conditions;
    }
    ?????

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Andrei

    (@andreiigna)

    Hi,

    Thanks for the interest in using the plugin!

    I’m not sure what would have happened with the plugin to suddenly stop working. Was the plugin updated recently? Or just the removed menu item is the only change?

    From checking the code for custom visibility rule, I see the id parameter is missing, and that is required for all visibility rules. Can you try adding that and see if resolved the problem?

    $conditions[] = array(
    'id' => 'is-get-help-page',
    'name' => 'Is a Get Help Page', // name of the condition
    'condition' => function($item) { // callback – must return TRUE or FALSE
    return is_page( array( 77, 196, 224, 372, 382, 389 ) );
    }

    Hope this helps

    • This reply was modified 5 years, 5 months ago by Andrei.

    It does not work for me either

    I have solved it by doing a rollback and updating again. This made my conditions reset and I have reset them. Now it works

    For me it not works either. After i save menu, it not save my conditions

    It has stopped working for me as well. I have rules in place and it works fine. I have tried to make new rules and they do not save.

    Hello @andreiigna

    the plugin stop working the area of select icon once i give the update to the new update of word press

    if you can assist to us that would be great.

    thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘If-Menu Seems to Have Stopped Working’ is closed to new replies.