Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. // Show content conditionally based on course type
  2. add_shortcode( 'ld_display_course_content', 'ld_shortcode_display_course_content' );
  3. function ld_shortcode_display_course_content( $atts , $content = null ) {
  4. global $post;
  5.  
  6. if( is_admin() || !$post || !$post->post_type == 'sfwd-courses' || !isset( $atts['course_type'] ) ) {
  7. return;
  8. }
  9.  
  10. $course_meta = get_post_meta($post->ID, '_sfwd-courses', true);
  11.  
  12. if($course_meta['sfwd-courses_course_price_type'] == $atts['course_type']) {
  13. return $content;
  14. } else {
  15. return;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement