Created
October 8, 2021 13:41
-
-
Save ideadude/961042ea2bc1685d44ffdbef0de724f3 to your computer and use it in GitHub Desktop.
Update the PMPro Courses Lessons CPT to have a frontend archive page.
This file contains hidden or 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
<?php | |
/** | |
* Update the PMPro Courses Lessons CPT to have a frontend archive page. | |
* Add this code into a custom plugin or Code Snippet. | |
* After adding this code, visit Settings -> Permalinks and save to | |
* 'flush the rewrite rules'. | |
* Then visit /lessons/ on your site. | |
* You can style this archive by adding a file named archive-pmpro_lesson.php | |
* to your child theme or theme. | |
*/ | |
function my_pmpro_lessons_has_archive( $args, $post_type ){ | |
if ( $post_type == 'pmpro_lesson' ){ | |
$args['has_archive'] = 'lessons'; | |
} | |
return $args; | |
} | |
add_filter( 'register_post_type_args', 'my_pmpro_lessons_has_archive', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment