Shortcode Development
LearnDash Dashboard registers 9 shortcodes through the Ld_Dashboard_Shortcodes singleton. All shortcodes use output buffering and support theme template overrides.
Available Shortcodes
Section titled “Available Shortcodes”[ld_dashboard]
Section titled “[ld_dashboard]”Renders the main frontend dashboard panel.
Attributes: None
Behavior:
- Shows a login notice and link for logged-out users (filterable via
ld_dashboard_login_noticeandld_dashboard_login_link). - Loads
templates/ld-dashboard.php(or theme override). - Displays role-appropriate tabs and content.
Template: templates/ld-dashboard.php
echo do_shortcode( '[ld_dashboard]' );[ld_instructor_registration]
Section titled “[ld_instructor_registration]”Displays the instructor application/registration form.
Attributes: None (delegates to LD_Dashboard_Instructor_Manager::registration_form())
Behavior: Shows the registration form to non-instructors. Logged-in instructors see a message that they are already registered.
[ld_dashboard_instructors_list]
Section titled “[ld_dashboard_instructors_list]”Displays a paginated, searchable grid of all instructors.
Attributes:
| Attribute | Default | Description |
|---|---|---|
col |
4 |
Number of grid columns |
Filters available:
ld_dashboard_instructors_columns— Modify column count.ld_dashboard_instructors_per_page— Items per page (default: 12).ld_dashboard_instructors_list— Filter the instructor WP_User array.ld_dashboard_instructor_data— Filter individual instructor data.ld_dashboard_instructor_courses— Filter courses shown per instructor.ld_dashboard_instructor_avatar— Filter instructor avatar HTML.ld_dashboard_instructor_name— Filter instructor display name.
If the URL matches an instructor profile (via instructor_username query var), a single instructor profile is shown instead of the grid.
Actions:
ld_dashboard_before_single_instructor— Fires before single instructor template.ld_dashboard_after_single_instructor— Fires after single instructor template.
Templates:
- Grid: No template file (inline output).
- Single profile:
templates/ld-dashboard-single-instructor.php.
[ld_student_details]
Section titled “[ld_student_details]”Displays student progress details. Visible to instructors, group leaders, and administrators only.
Attributes: None
Template: templates/ld-dashboard-student-status.php
[ld_email]
Section titled “[ld_email]”Displays the email integration interface for sending bulk emails to students.
Attributes: None
Visibility: Only shown when the enable-email-integration general setting is enabled and the user is an instructor, group leader, or administrator.
Template: templates/ld-dashboard-email-integration.php
[ld_enrollment_code_redeem]
Section titled “[ld_enrollment_code_redeem]”Displays an enrollment code redemption widget for logged-in users.
Attributes: None
Behavior: Returns empty string for logged-out users. Enqueues ld-dashboard-enrollment-codes style and script.
Template: templates/dashboard-widgets/enrollment-code-redeem.php
[ld_dashboard_meeting]
Section titled “[ld_dashboard_meeting]”Displays a list of Zoom meetings. Requires the Zoom module to be active.
Attributes:
| Attribute | Default | Description |
|---|---|---|
id |
— | Meeting post ID |
title |
Details |
Section title |
Template: templates/ld-dashboard-meeting-shortcode.php
[ld_dashboard_meeting_single]
Section titled “[ld_dashboard_meeting_single]”Displays a single Zoom meeting detail view.
Attributes:
| Attribute | Default | Description |
|---|---|---|
id |
— | Meeting post ID |
title |
Details |
Section title |
Template: templates/ld-dashboard-single-meeting.php
[ld_dashboard_meeting_embed]
Section titled “[ld_dashboard_meeting_embed]”Embeds a Zoom meeting via iframe or SDK.
Attributes:
| Attribute | Default | Description |
|---|---|---|
meeting_id |
— | Zoom meeting ID |
height |
500px |
Frame height |
iframe |
yes |
Enable iframe embed |
disable_countdown |
no |
Disable pre-join countdown |
Zoom shortcodes only render when ld_dashboard_is_zoom_enabled() returns true.
Template Override System
Section titled “Template Override System”All shortcodes use Ld_Dashboard_Shortcodes::locate_template() to find templates. The lookup order is:
- Active child theme:
{child-theme}/ld-dashboard/{template-name} - Active parent theme:
{parent-theme}/ld-dashboard/{template-name} - Plugin:
{plugin}/templates/{template-name}
To override a template, copy it from the plugin’s templates/ directory to your theme’s ld-dashboard/ directory.
mytheme/└── ld-dashboard/ └── ld-dashboard.php # Overrides main dashboard template └── ld-dashboard-student-status.phpOutput Buffering Pattern
Section titled “Output Buffering Pattern”All shortcode render methods use WordPress’s recommended output buffering pattern:
public function render_my_shortcode( $atts, $content = '' ) { ob_start();
// Template or inline output. $template = $this->locate_template( 'my-template.php' ); if ( $template ) { include $template; }
return ob_get_clean();}This ensures shortcodes return HTML rather than echo it directly, which is required for correct WordPress shortcode behavior.
Permission Checks
Section titled “Permission Checks”Shortcodes perform role checks before rendering content:
// Check if user is an instructor, group leader, or admin.if ( ! learndash_is_group_leader_user() && ! learndash_is_admin_user() && ! LD_Dashboard_Helper::is_instructor()) { return ''; // Return empty for students.}The [ld_dashboard] shortcode shows a login prompt for logged-out users rather than returning empty.
Adding Custom Shortcodes
Section titled “Adding Custom Shortcodes”You can add custom shortcodes that integrate with the dashboard’s template system by hooking into WordPress’s add_shortcode during init. You can also extend Ld_Dashboard_Shortcodes if you need access to locate_template().
add_action( 'init', function() { add_shortcode( 'my_dashboard_widget', function( $atts ) { // Only for logged-in users. if ( ! is_user_logged_in() ) { return ''; }
$atts = shortcode_atts( array( 'title' => __( 'My Widget', 'my-plugin' ) ), $atts );
ob_start();
// Check theme override first. $theme_template = get_stylesheet_directory() . '/ld-dashboard/my-widget.php'; $plugin_template = MY_PLUGIN_DIR . 'templates/my-widget.php';
if ( file_exists( $theme_template ) ) { include $theme_template; } elseif ( file_exists( $plugin_template ) ) { include $plugin_template; }
return ob_get_clean(); } );} );Within your template file, you have access to $atts (shortcode attributes) and all standard WordPress globals.

