2013-10-07 79 views
2

我已經很努力地創建一個WordPress功能,我卡住了。我非常肯定,對於你們中的一些人來說,需要2秒才能搞清楚。我熟悉WordPress,我知道我的方式,但我缺乏編碼技能。請幫助我糾正此功能,請記住,我希望我的橫幅和徽標包含在內,這就是:<div class="wrap"> and <div class="icon32" id="icon-index"><br></div>的全部內容。WordPress的男人/ Sub_Menu功能

我想要做的是以下操作:在WordPress儀表板中爲管理員和訂戶顯示主菜單項,並顯示主菜單標題爲「對於買家」,然後添加具有以下標題的子菜單:營銷材料 - 首次購買者 - 潛在顧客 - 廣告系列。

非常感謝,這是一個美好的社區:)。

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"; 

} 

回答

0

我弄明白了並解決了它謝謝:)。

//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 

}