Bird
Raised Fist0
Wordpressframework~30 mins

Dashboard navigation in Wordpress - Mini Project: Build & Apply

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Dashboard navigation
📖 Scenario: You are building a WordPress plugin that needs its own settings page in the admin dashboard. You need to add a top-level menu item with a submenu for general and advanced settings.
🎯 Goal: Add custom admin menu pages to the WordPress dashboard using add_menu_page() and add_submenu_page(), and create the callback functions that render each page.
📋 What You'll Learn
Create a top-level menu item called 'My Plugin'
Add two submenu pages: General and Advanced
Create callback functions that render HTML for each page
Hook everything to the admin_menu action
💡 Why This Matters
🌍 Real World
Every WordPress plugin with settings needs admin menu pages. This is the standard way to add configuration interfaces to the WordPress dashboard.
💼 Career
WordPress developers must know how to create and organize admin menus for building professional plugins and themes.
Progress0 / 4 steps
1
Create the main menu page callback
Create a PHP function called my_plugin_main_page that outputs a simple HTML wrapper with an <h1> tag saying 'My Plugin Settings' wrapped in a div with class wrap.
Wordpress
Hint

WordPress admin pages use <div class="wrap"> as the standard container.

2
Create the advanced page callback
Create a function called my_plugin_advanced_page that outputs HTML with an <h1> saying 'Advanced Settings' wrapped in a div with class wrap.
Wordpress
Hint

Follow the same pattern as the main page but with 'Advanced Settings' as the heading.

3
Register menu and submenu pages
Create a function called my_plugin_admin_menu. Inside, use add_menu_page() to register 'My Plugin' as a top-level menu with slug 'my-plugin', capability 'manage_options', callback 'my_plugin_main_page', and dashicon 'dashicons-admin-generic'. Then add a submenu page for 'Advanced' with slug 'my-plugin-advanced' and callback 'my_plugin_advanced_page'.
Wordpress
Hint

Use add_menu_page() for the top-level item and add_submenu_page('my-plugin', ...) for the submenu.

4
Hook to admin_menu action
Use add_action() to hook my_plugin_admin_menu to the 'admin_menu' action so WordPress registers your menu pages when the admin loads.
Wordpress
Hint

Use add_action('admin_menu', 'my_plugin_admin_menu') to register the hook.

Practice

(1/5)
1. What is the main purpose of dashboard navigation in WordPress Business Intelligence reports?
easy
A. To help users find information quickly and easily
B. To add decorative elements to the dashboard
C. To slow down page loading times
D. To hide important data from users

Solution

  1. Step 1: Understand dashboard navigation purpose

    Dashboard navigation is designed to guide users to key information efficiently.
  2. Step 2: Eliminate incorrect options

    Slowing down page loads, adding decoration, and hiding data do not improve user experience or data access.
  3. Final Answer:

    To help users find information quickly and easily -> Option A
  4. Quick Check:

    Navigation improves user access = C [OK]
Hint: Navigation means easy access to info [OK]
Common Mistakes:
  • Thinking navigation is just decoration
  • Confusing navigation with page speed
  • Assuming navigation hides data
2. Which WordPress feature is commonly used to create dashboard navigation menus?
easy
A. Anchor links inside posts
B. Comment sections
C. Image galleries
D. WordPress menu blocks

Solution

  1. Step 1: Identify navigation creation tools in WordPress

    WordPress menu blocks are designed to build navigation menus easily.
  2. Step 2: Exclude unrelated features

    Anchor links help navigation but are not menu creators; galleries and comments are unrelated.
  3. Final Answer:

    WordPress menu blocks -> Option D
  4. Quick Check:

    Menus built with menu blocks = B [OK]
Hint: Menus use menu blocks, not galleries or comments [OK]
Common Mistakes:
  • Confusing anchor links with menu creation
  • Using galleries for navigation
  • Thinking comments create menus
3. Given this WordPress menu block setup for dashboard navigation:
- Home
- Sales Report
- Customer Data
- Settings

What happens when a user clicks 'Customer Data'?
medium
A. The dashboard reloads the Home page
B. The page scrolls or navigates to the Customer Data section
C. Nothing happens because menus are decorative
D. The user is logged out automatically

Solution

  1. Step 1: Understand menu block behavior

    Clicking a menu item navigates or scrolls to the linked section or page.
  2. Step 2: Analyze each option

    Reloading the home page, nothing happening because decorative, or logging out do not match expected navigation behavior.
  3. Final Answer:

    The page scrolls or navigates to the Customer Data section -> Option B
  4. Quick Check:

    Menu click triggers navigation = A [OK]
Hint: Menu clicks navigate to linked sections [OK]
Common Mistakes:
  • Assuming menus do nothing
  • Thinking menu clicks reload unrelated pages
  • Confusing navigation with logout
4. You created a dashboard navigation menu in WordPress but keyboard users cannot tab through the menu items. What is the likely issue?
medium
A. Missing proper ARIA labels and tabindex settings
B. The menu items are images without links
C. The dashboard has no data
D. The WordPress theme is outdated

Solution

  1. Step 1: Identify accessibility requirements

    Keyboard navigation requires ARIA labels and correct tabindex for focus order.
  2. Step 2: Evaluate other options

    Images without links prevent tabbing; no data or theme age do not directly affect keyboard navigation.
  3. Final Answer:

    Missing proper ARIA labels and tabindex settings -> Option A
  4. Quick Check:

    Accessibility needs ARIA and tabindex = D [OK]
Hint: Keyboard navigation needs ARIA and tabindex [OK]
Common Mistakes:
  • Ignoring accessibility attributes
  • Blaming theme instead of markup
  • Thinking data presence affects navigation
5. You want to create a dashboard navigation in WordPress that is accessible, responsive, and allows users to jump to report sections quickly. Which combination of features should you use?
hard
A. Comment widgets with dropdown menus
B. Image galleries with no links and custom CSS
C. WordPress menu blocks with anchor links and ARIA labels
D. Static text blocks with no navigation

Solution

  1. Step 1: Identify features for accessibility and responsiveness

    Menu blocks provide structure, anchor links enable quick jumps, ARIA labels ensure accessibility.
  2. Step 2: Exclude unsuitable options

    Galleries, comments, and static text lack navigation and accessibility features needed.
  3. Final Answer:

    WordPress menu blocks with anchor links and ARIA labels -> Option C
  4. Quick Check:

    Combine menus, anchors, ARIA for best navigation = A [OK]
Hint: Use menus + anchors + ARIA for accessible navigation [OK]
Common Mistakes:
  • Using images without links for navigation
  • Relying on comments for menus
  • Ignoring accessibility and responsiveness