LLMS_Student_Dashboard::modify_dashboard_title( string $title )

Handle modification of the default dashboard title for certain pages and sub pages


Parameters Parameters

$title

(string) (Required) default title HTML


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class.llms.student.dashboard.php

	public function modify_dashboard_title( $title ) {

		global $wp_query;
		$tab = self::get_current_tab( 'tab' );

		if ( 'my-grades' === $tab && ! empty( $wp_query->query['my-grades'] ) ) {

			$course = get_posts(
				array(
					'name'      => $wp_query->query['my-grades'],
					'post_type' => 'course',
				)
			);

			$course = array_shift( $course );
			if ( $course ) {

				$data = self::get_current_tab();

				$new_title  = '<a href="' . esc_url( llms_get_endpoint_url( 'my-grades' ) ) . '">' . $data['title'] . '</a>';
				$new_title .= sprintf( ' %1$s <a href="%2$s">%3$s</a>', apply_filters( 'llms_student_dashboard_title_separator', '<small>&gt;</small>' ), get_permalink( $course->ID ), get_the_title( $course->ID ) );

				$title = str_replace( $data['title'], $new_title, $title );

			}
		}

		return $title;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.