SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top