0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function park_content_filter( $content ) { $new_content = '<div class="camp-wrap clearfix">'; $new_content .= '<div class="item-title">Camp</div>'; $new_content .= '<div class="item-value">Description</div>'; if(function_exists('get_field') && get_field('camp')){// camp is the field group while(has_sub_field('camp')){ $new_content .= '<div class="item-title">' . get_sub_field('camp_name') . '</div>'; $new_content .= '<div class="item-value">' . get_sub_field('camp_description') . '</div>'; } } $new_content .= '</div><!--camp-wrap-->'; $content = $content . $new_content; return $content; } function add_park_filter(){ if(is_singular( 'park' ))// park is the custom post type add_filter('the_content', 'park_content_filter', 1); } add_action('template_redirect', 'add_park_filter'); |