WordPress Men/Sub_Menu Functions

I have worked so hard to create a WordPress function and I got stuck. I am pretty sure that for some of you it will take 2 second to figure it out. I am familiar with WordPress and I know my way around it but i lack coding skills. Please help me correct this function keeping in mind that I want my banner and logo included and that’s what the: <div class="wrap"> and <div class="icon32" id="icon-index"><br></div> is all about.

What I am trying to do is the followings: Have a Main menu item in WordPress Dashboard for both Admins and Subscribers to be displayed with the main Menu titled: “For Buyers” then add submenus with the following titles: Marketing Materials – First Time Buyers – Lead Generation – Ad campaigns.

Read More

Thank you so much, this is a wonderful community :).

add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page(){
    add_menu_page( "For Buyers", "For Buyers", "manage_options", "for_buyers", "add_buyers_function", '', 61 );
    add_submenu_page( "for_buyers", " Marketing Materials", " Marketing Materials", "manage_options", "marketing_materials","add_marketing_materials");
} 
function add_buyers_function(){
    ?>
    <div class="wrap">
        <div class="icon32" id="icon-index"><br></div>
    </div>
    <?php 

}

//marketing materials for buyers wordpress menu
function add_marketing_materials(){

    ?>
    <div class="wrap">
        <div class="icon32" id="icon-index"><br></div>
    </div>
    <?php 
    echo "child page for marketing materials";

}

Related posts

Leave a Reply

1 comment

  1. I did figure it out and solved it Thank you :).

    //marketing materials for buyers wordpress menu
    add_action( 'admin_menu', 'register_my_custom_menu_page' );
    
    function register_my_custom_menu_page(){
         add_menu_page( "For Buyers", "For Buyers", "manage_options", "for_buyers", "add_buyers_function" );
     add_submenu_page( "for_buyers", "", "", "manage_options", "for_buyers","add_buyers_function");
     add_submenu_page( "for_buyers", "Marketing Materials", "Marketing Materials", "manage_options", "marketing_materials","add_marketing_materials");
     add_submenu_page( "for_buyers", "First Time Buyers", "First Time Buyers", "manage_options", "first_time_buyers","add_first_time_buyers");
     add_submenu_page( "for_buyers", "Lead Generation", "Lead Generation", "manage_options", "lead_generation","add_lead_generation");
     add_submenu_page( "for_buyers", "Ad Campaign", "Ad Campaign", "manage_options", "ad_campaign","add_ad_campaign");
    
    } 
    function add_buyers_function(){
        ?>
        <div class="wrap">
            <div class="icon32" id="icon-index"><br></div>
        </div>
        <?php 
    
    }
    
    //buyers wordpress menu
    
    function add_marketing_materials(){
    
        ?>
        <div class="wrap">
            <div class="icon32" id="icon-index"><br></div>
        </div>
        <?php 
    
    }
    
    //first time buyers wordpress sub menu
    
    function add_first_time_buyers(){
    
        ?>
        <div class="wrap">
            <div class="icon32" id="icon-index"><br></div>
        </div>
        <?php 
    
    }
    
    //lead generation wordpress sub menu
    
    function add_lead_generation(){
    
        ?>
        <div class="wrap">
            <div class="icon32" id="icon-index"><br></div>
        </div>
        <?php 
    
    }
    
    //ad campaign wordpress sub menu
    
    function add_ad_campaign(){
    
        ?>
        <div class="wrap">
            <div class="icon32" id="icon-index"><br></div>
        </div>
        <?php 
    
    }