Created
March 22, 2019 17:40
-
-
Save MrVibe/e519ef7854aaacd516d43aaa03d50a11 to your computer and use it in GitHub Desktop.
Custom featured block in Course directory
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
add_filter('bp_course_single_item_view',function($flag,$post){ | |
$course_post_id = $post->ID; | |
$course_author= $post->post_author; | |
$course_classes = apply_filters('bp_course_single_item','course_single_item course_id_'.$post->ID.' course_status_'.$post->post_status.' course_author_'.$post->post_author,get_the_ID()); | |
?> | |
<li class="<?php echo $course_classes; ?>"> | |
<?php echo do_shortcode('[course id="'.$course_post_id.'" featured_block="course"]'); ?> | |
</li> | |
<?php | |
return 1; | |
},10,2); | |
add_action('wp_head',function(){ | |
if(is_page(vibe_get_bp_page_id('course')) || bp_is_directory('course')){ | |
?> | |
<style>#buddypress #course-list.item-list { | |
display: grid !important;padding-top:25px;border-top:none; | |
grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); | |
grid-gap: 30px; | |
}#buddypress #course-list.item-list.grid >li{ | |
width:100% !important; | |
padding: 0; | |
}#buddypress #course-list.item-list li{border:none;padding:0;}.grid_list_wrapper{display:none;}</style> | |
<?php | |
} | |
},99); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment