-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Theme: Make get_my_courses_page_url safe to call
Fixes exception where get_my_courses_page_url is undefined. Move this helper function from the plugin to the theme as it is only used in theme templates.
- Loading branch information
1 parent
cfb2a66
commit 2f686c3
Showing
5 changed files
with
24 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
wp-content/themes/pub/wporg-learn-2024/inc/template-helpers.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace WordPressdotorg\Theme\Learn_2024\Template_Helpers; | ||
|
||
/** | ||
* Get the URL of the "My Courses" page. | ||
* | ||
* @return string The URL of the "My Courses" page. | ||
*/ | ||
function get_my_courses_page_url() { | ||
if ( function_exists( 'Sensei' ) ) { | ||
$page_id = Sensei()->settings->get_my_courses_page_id(); | ||
|
||
return $page_id ? get_permalink( $page_id ) : ''; | ||
} | ||
|
||
return ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters