kompass/includes/frontend-functions.php

165 lines
3.8 KiB
PHP
Raw Permalink Normal View History

2023-12-30 14:28:21 +01:00
<?php
add_action('admin_enqueue_scripts', 'bdp_update_dashboard_style');
add_action('login_enqueue_scripts', 'bdp_update_login_style');
function bdp_update_login_style() {
$css = file_get_contents(BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl');
echo str_replace('%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css);
}
function bdp_update_dashboard_style() {
wp_enqueue_style('custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css');
wp_enqueue_style('custom-calendar-styles', BDP_LV_PLUGIN_URL . '/assets/calendar.css');
wp_enqueue_style('custom-security-styles', BDP_LV_PLUGIN_URL . '/assets/security.css');
}
function bdp_add_menu_security() {
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
}
function bdp_add_menu_contents() {
2024-03-16 14:21:57 +01:00
add_menu_page('Seiten',
'Inhalte',
'edit_posts',
'edit.php?post_type=page',
'',
'dashicons-format-aside',
4
);
2023-12-30 14:28:21 +01:00
2024-03-16 14:21:57 +01:00
add_submenu_page('edit.php?post_type=page',
2023-12-30 14:28:21 +01:00
'media',
'Medienverwaltung',
'edit_posts',
'upload.php'
);
2024-03-16 14:21:57 +01:00
add_submenu_page('edit.php?post_type=page',
2023-12-30 14:28:21 +01:00
'comments',
'Kommentare',
'edit_posts',
'edit-comments.php'
);
2024-03-16 14:21:57 +01:00
add_submenu_page('edit.php?post_type=page',
'Beiträge',
'Beiträge',
'edit_posts',
'edit.php'
);
2023-12-30 14:28:21 +01:00
}
function bdp_add_menu_mein_lv() {
$location = BDP_LV_PLUGIN_DIR . '/modules/';
$mainSlug = $location . 'index.php';
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
add_menu_page(
2024-02-26 14:47:51 +01:00
'Mein BdP',
2023-12-30 14:28:21 +01:00
'BdP',
'show_bdp',
2023-12-30 14:28:21 +01:00
$mainSlug,
'',
BDP_LV_PLUGIN_URL . '/icon.png',
3
);
add_submenu_page($mainSlug,
'Über',
'Über',
'show_bdp',
2023-12-30 14:28:21 +01:00
$moduleLoad . 'about'
);
}
function bdp_add_menu_setup() {
add_menu_page(
'Benutzer',
'Benutzer-Verwaltung',
'manage_options',
'users.php',
'',
'dashicons-admin-users',
6
);
2023-12-30 14:28:21 +01:00
add_menu_page(
'Allgemeine Einstellungen',
'Webseiten-Setup',
'manage_options',
'options-general.php',
2023-12-30 14:28:21 +01:00
'',
'dashicons-admin-generic',
6
);
add_submenu_page('options-general.php',
2023-12-30 14:28:21 +01:00
'Design-Einstellungen',
2024-02-26 14:47:51 +01:00
'Template bearbeiten',
2023-12-30 14:28:21 +01:00
'manage_options',
'customize.php?return=/wp-admin/'
);
add_submenu_page('options-general.php',
2023-12-30 14:28:21 +01:00
'plugins',
'Erweiterungen',
'manage_options',
'plugins.php'
);
add_submenu_page('options-general.php',
2023-12-30 14:28:21 +01:00
'themes',
'Designs',
'manage_options',
'themes.php'
);
2024-02-26 14:47:51 +01:00
add_submenu_page('options-general.php',
2024-02-26 14:47:51 +01:00
'Sicherheit',
'Webseiten-Sicherheit',
'manage_options',
'site-health.php'
);
2023-12-30 14:28:21 +01:00
}
function bdp_cleanup_menu()
{
global $submenu;
remove_menu_page('edit-comments.php');
remove_menu_page('edit.php');
remove_menu_page('edit.php?post_type=page');
remove_menu_page('upload.php');
remove_menu_page('themes.php');
remove_menu_page('plugins.php');
remove_menu_page('options-general.php');
remove_menu_page('users.php');
remove_menu_page('tools.php');
bdp_add_menu_contents();
bdp_add_menu_setup();
bdp_add_menu_security();
2024-03-16 14:21:57 +01:00
remove_submenu_page('edit.php?post_type=page','post-new.php?post_type=page');
2023-12-30 14:28:21 +01:00
remove_submenu_page('users.php','user-new.php');
remove_submenu_page('users.php','profile.php');
remove_submenu_page('edit.php','post-new.php');
remove_submenu_page('edit.php','edit-tags.php?taxonomy=category');
remove_submenu_page('edit.php','edit-tags.php?taxonomy=post_tag');
}
function bdp_create_menu_structure()
{
add_action('admin_menu', 'bdp_cleanup_menu');
bdp_add_menu_mein_lv();
}