diff --git a/wp-content/plugins/wporg-learn/inc/sensei.php b/wp-content/plugins/wporg-learn/inc/sensei.php index 416cf219b..1c6dd56a8 100644 --- a/wp-content/plugins/wporg-learn/inc/sensei.php +++ b/wp-content/plugins/wporg-learn/inc/sensei.php @@ -254,21 +254,6 @@ class="sensei-date-picker" } add_action( 'sensei_reports_overview_before_top_filters', __NAMESPACE__ . '\wporg_learn_add_student_count_to_reports' ); -/** - * Get the URL of the "My Courses" page. - * - * @return string The URL of the "My Courses" page. - */ -function get_my_courses_page_url() { - $page_id = Sensei()->settings->get_my_courses_page_id(); - - if ( ! $page_id ) { - return ''; - } - - return get_permalink( $page_id ); -} - /** * Redirect requests for the "My Courses" page to the login page and back, if logged out. */ diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index c2788dfe9..cac7ce2c7 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -3,7 +3,8 @@ namespace WordPressdotorg\Theme\Learn_2024; use WP_HTML_Tag_Processor; -use function WPOrg_Learn\Sensei\{get_my_courses_page_url, get_lesson_has_published_course}; +use function WPOrg_Learn\Sensei\{get_lesson_has_published_course}; +use function WordPressdotorg\Theme\Learn_2024\Template_Helpers\{get_my_courses_page_url}; // Block files require_once __DIR__ . '/src/card-featured-image-a11y/index.php'; @@ -20,8 +21,9 @@ require_once __DIR__ . '/src/upcoming-online-workshops/index.php'; require_once __DIR__ . '/inc/block-config.php'; require_once __DIR__ . '/inc/block-hooks.php'; -require_once __DIR__ . '/inc/query.php'; require_once __DIR__ . '/inc/head.php'; +require_once __DIR__ . '/inc/query.php'; +require_once __DIR__ . '/inc/template-helpers.php'; /** * Actions and filters. diff --git a/wp-content/themes/pub/wporg-learn-2024/inc/template-helpers.php b/wp-content/themes/pub/wporg-learn-2024/inc/template-helpers.php new file mode 100644 index 000000000..78cdf04f8 --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/inc/template-helpers.php @@ -0,0 +1,18 @@ +settings->get_my_courses_page_id(); + + return $page_id ? get_permalink( $page_id ) : ''; + } + + return ''; +} diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/page-learning-pathways-content.php b/wp-content/themes/pub/wporg-learn-2024/patterns/page-learning-pathways-content.php index d5df6980b..c63e27c69 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/page-learning-pathways-content.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/page-learning-pathways-content.php @@ -5,7 +5,7 @@ * Inserter: no */ -use function WPOrg_Learn\Sensei\{get_my_courses_page_url} +use function WordPressdotorg\Theme\Learn_2024\Template_Helpers\{get_my_courses_page_url}; ?> diff --git a/wp-content/themes/pub/wporg-learn-2024/patterns/sidebar-course.php b/wp-content/themes/pub/wporg-learn-2024/patterns/sidebar-course.php index 52080c0ae..b9653e56a 100644 --- a/wp-content/themes/pub/wporg-learn-2024/patterns/sidebar-course.php +++ b/wp-content/themes/pub/wporg-learn-2024/patterns/sidebar-course.php @@ -7,7 +7,7 @@ * @package wporg-learn-2024 */ -use function WPOrg_Learn\Sensei\{get_my_courses_page_url}; +use function WordPressdotorg\Theme\Learn_2024\Template_Helpers\{get_my_courses_page_url}; $completed_course = Sensei_Utils::user_completed_course( get_the_ID() ); $current_post = get_post();