• to have more then one condition, this code worked for me

    function conditional_menu($conditions) {
        $conditions[] = array(
            'name'      =>  'Cond1', // name of the condition
            'condition' =>  function($item) {   // callback - must return TRUE or FALSE
                //check smt
                if (func() == 'value1') {
                    return TRUE;
                } else {
                    return FALSE;
                }
            }
        );
        $conditions[] = array(
            'name'      =>  'Cond2', // name of the condition
            'condition' =>  function($item) {   // callback - must return TRUE or FALSE
                if (func() == 'value2') {
                    return TRUE;
                } else {
                    return FALSE;
                }
            }
        );
        //and so on...
        return $conditions;
    }
    add_filter( 'if_menu_conditions', 'conditional_menu');

    `
    https://www.ads-software.com/plugins/if-menu/

Viewing 1 replies (of 1 total)
  • Hey Finnwulf,
    thank you so much for sharing this – that was exactly the info I needed this morning.
    Works like a charm,

    have a good day & cheers,
    Tom

Viewing 1 replies (of 1 total)
  • The topic ‘more then one custom condition’ is closed to new replies.