WordPress.org

Ready to get started?Download WordPress

Forums

If Menu
Customized roles (2 posts)

  1. danicasati
    Member
    Posted 1 year ago #

    Hi.
    I put customized rules on my website, but they can't display in conditions.
    How can I add customized roles to dropdown menu?

    http://wordpress.org/extend/plugins/if-menu/

  2. BramNL
    Member
    Posted 1 year ago #

    The example in the FAQ is fairly incomplete.

    You could add the following to the functions.php of your (child) theme:

    add_filter( 'if_menu_conditions', 'my_new_menu_conditions' );
    function my_new_menu_conditions( $conditions ) {
        $conditions[] = array(
            'name'      =>  'If single custom-post-type',   // name of the condition
            'condition' =>  function() {                    // callback - must return TRUE or FALSE
                return is_singular( 'my-custom-post-type' );
            }
        );
    
    	return $conditions;
    }

    Note about the "return $conditions;". That one is missing in the example but is very important!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic