Jump to content

Recommended Posts

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.

 

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

}
Edited by kwmlr439
Link to comment
https://forums.phpfreaks.com/topic/282809-wordpress_mensub_menu-functions/
Share on other sites

I did solve this 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

}
 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.