برای ایجاد صفحه و نمایش دلخواه آن در منو میتوانید از هوک زیر استفاده نمایید.
قبل از ایجاد صفحه، حتما یک مجوز دسترسی طبق راهنما در بخش (اضافه کردن سطح دسترسی) ایجاد نمایید و از آن در شماره خط 10 استفاده نمایید.
add_filter("la24_account_menu_items", "la24_add_page", 1);
function la24_add_page($endpoints)
{
$endpoints['my_page'] = array(
"name" = "Your Name Page",
'endpoint' = "my_page", //slug page
"sub" = 0, //If this item has a submenu, set it 1, otherwise it is 0
'parent' = "", // If you want this item to be under the menu of another item, enter its ID, otherwise leave blank
'capability' = 'your_uniqID_cap', //Enter the capability ID required to view this page
'icon' = "fa fa-circle-o", //class icon
'show_status' = "1", //If you want this item to be displayed in the menu, set it 1, otherwise 0
"priority" = 4, //Menu display priority
"locate" = "your_dir/your_file.php" // Enter the dir path to the file to be include
);
return $endpoints;
}
*خط 14: یک فایل php در سرور ایجاد نمایید و مسیر دایرکتوری آن را فراخوانی کنید. این فایل در هنگام اجرا include خواهد شد. برای فراخوانی مسیر فایل میتوانید از تابع زیر استفاده نمایید.
plugin_dir_path( __FILE__ )