鉴于此简码
[lifterlms_courses category="example-slug" order="ASC" orderby="date" posts_per_page="5"]
我如何覆盖它,创建我的自定义简码,以便我可以根据用户选择的研究来提取课程每项研究都会有它的课程;在注册时,用户选择研究
add_action( 'init', 'myplugin_Init' );
function myplugin_Init(){
add_shortcode('all-courses', 'get_all_courses');
}
function get_all_courses(){
$user_id = get_current_user_id();
$study_001 = get_user_meta( $user_id, 'study_001', false) ;
if ($study_001) {
$study = 'study_001';
}else{
$study = 'default_study';
}
$query_args = apply_filters(
'llms_dashboard_courses_wp_query_args',
array(
'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
'orderby' => 'date',
'post__in' => $study,
'order' => 'ASC',
'post_status' => 'publish',
'post_type' => 'course',
'posts_per_page' => 15,
)
);
$query = new WP_Query( $query_args );
add_filter( 'paginate_links', 'llms_modify_dashboard_pagination_links' );
custom_lifterlms_loop( $query );
}