2

我非常努力地创建了一个 WordPress 功能,但我被卡住了。我很确定,对于你们中的一些人来说,需要 2 秒钟才能弄清楚。我熟悉 WordPress,我知道我的方式,但我缺乏编码技能。请帮助我更正此功能,请记住我希望包含我的横幅和徽标,这就是:<div class="wrap"> and <div class="icon32" id="icon-index"><br></div>的全部内容。

我想要做的是以下内容:在 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";

}
4

1 回答 1

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 

}
于 2013-10-08T17:38:59.553 回答