0
0
Wordpressframework~10 mins

Dashboard navigation in Wordpress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to open the WordPress dashboard menu.

Wordpress
wp_nav_menu(array('theme_location' => '[1]'));
Drag options to blanks, or click blank then click option'
Adashboard
Bprimary
Csidebar
Dfooter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'primary' or 'footer' which are for other menus.
Leaving the menu location empty.
2fill in blank
medium

Complete the code to add a dashboard submenu page in WordPress.

Wordpress
add_submenu_page('[1]', 'Reports', 'Reports', 'manage_options', 'reports', 'reports_callback');
Drag options to blanks, or click blank then click option'
Aoptions-general.php
Btools.php
Cedit.php
Dindex.php
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tools.php' or 'options-general.php' which are other menu slugs.
Confusing the parent slug with the submenu slug.
3fill in blank
hard

Fix the error in the code to correctly add a dashboard widget.

Wordpress
wp_add_dashboard_widget('[1]', 'Site Stats', 'dashboard_stats_function');
Drag options to blanks, or click blank then click option'
Adashboard-widget
Bsite_stats
Cdashboard_stats
Dstats_dashboard
Attempts:
3 left
💡 Hint
Common Mistakes
Using IDs with dashes or spaces causing errors.
Using IDs that are too generic or conflicting.
4fill in blank
hard

Fill both blanks to register a dashboard menu page with the correct capability and slug.

Wordpress
add_menu_page('Dashboard Reports', 'Reports', '[1]', '[2]', 'reports_callback');
Drag options to blanks, or click blank then click option'
Amanage_options
Bedit_posts
Cdashboard_reports
Dreports_page
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'edit_posts' which is a lower capability.
Using slugs with spaces or special characters.
5fill in blank
hard

Fill all three blanks to correctly enqueue a dashboard-specific script.

Wordpress
function load_dashboard_scripts() {
  if (get_current_screen()->[1] === '[2]') {
    wp_enqueue_script('[3]', plugin_dir_url(__FILE__) . 'dashboard.js');
  }
}
add_action('admin_enqueue_scripts', 'load_dashboard_scripts');
Drag options to blanks, or click blank then click option'
Aid
Bbase
Cdashboard-script
Ddashboard
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' instead of 'base' causes the condition to fail.
Using incorrect page slug or script handle.