summaryrefslogtreecommitdiffstats
path: root/giglogadmin.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-02-21 14:34:14 +0100
committerHarald Eilertsen <haraldei@anduin.net>2021-02-21 14:34:14 +0100
commitd7f1eccafc8013b20a5f23e5b5c97df458ea6081 (patch)
tree6a098665a2715d818133d4132888294ecfe3e525 /giglogadmin.php
parenta176f66a860634b0975eee6894f075fe21e65cdf (diff)
downloadgigologadmin-d7f1eccafc8013b20a5f23e5b5c97df458ea6081.tar.gz
gigologadmin-d7f1eccafc8013b20a5f23e5b5c97df458ea6081.tar.bz2
gigologadmin-d7f1eccafc8013b20a5f23e5b5c97df458ea6081.zip
Add top level menu to WordPress admin menu.
Currently nothing useful on the page, but a placeholder for a more useful page later, and possibly submenus for other functionality. The menu is placed right below the 'Media' menu for now, and is available to anyone with the 'upload_files' capability. Both of these may be adjusted later if there's a better location or other capabilities fit better.
Diffstat (limited to 'giglogadmin.php')
-rw-r--r--giglogadmin.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/giglogadmin.php b/giglogadmin.php
index 1157d73..091cdcf 100644
--- a/giglogadmin.php
+++ b/giglogadmin.php
@@ -24,6 +24,7 @@ if ( !class_exists( 'GiglogAdmin_Plugin' ) ) {
require_once __DIR__ . '/includes/public/shortcodes/giglog_display_unprocessed.php';
require_once __DIR__ . '/includes/public/shortcodes/giglog_photographers.php';
require_once __DIR__ . '/includes/public/shortcodes/giglog_process_files.php';
+ require_once __DIR__ . '/includes/admin/views/giglog_admin_page.php';
class GiglogAdmin_Plugin
{
@@ -34,6 +35,7 @@ if ( !class_exists( 'GiglogAdmin_Plugin' ) ) {
add_shortcode('giglog_upload', 'giglogadmin_upload_files');
add_shortcode('giglog_photog', 'giglogadmin_photographers');
+ add_action( 'admin_menu', array( 'GiglogAdmin_Plugin', 'add_admin_pages' ));
add_filter( 'wp_nav_menu_args', array( 'GiglogAdmin_Plugin', 'nav_menu_args' ));
}
@@ -44,6 +46,21 @@ if ( !class_exists( 'GiglogAdmin_Plugin' ) ) {
static function deactivate() {
}
+ /**
+ * Adds the 'Giglog' top level menu to the left side WordPress admin
+ * menu. Other subpages will come later.
+ */
+ static function add_admin_pages() {
+ add_menu_page(
+ "Giglog", // Page title
+ "Giglog", // Menu title
+ "upload_files", // Will show for users with this capability
+ "giglog", // menu slug
+ array( 'GiglogAdmin_AdminPage', 'render_html' ), // callable
+ 'dashicons-tickets-alt', // Icon url
+ 11); // Position, just below 'Media'
+ }
+
/*
* Show menus based on whether user is logged in or not.
*