function wpautop_control_filter($content) { global $post, $tempPost; // check the temporary $post reassignment for context specific $post data $the_post = isset($tempPost) ? $tempPost : $post; // Get wpautop setting $remove_filter = wpautop_filter($the_post->ID); // turn on/off if ($remove_filter) { remove_filter('the_content', 'wpautop'); remove_filter('the_excerpt', 'wpautop'); } return $content; }
function theme_get_page($id, $title = false) { global $post, $tempPost; if (!$id) { return false; } // Get the page contenet $page_data = get_page($id); if ($page_data == null) { $page_data = $post; } $content = $page_data->post_content; // get the content // Apply filters if (get_meta('content_filters', $id) == 'All Content Filters') { // This option applies all content filters, including those added by plugins. It still makes use of the filters in Theme Settings $tempPost = $page_data; // Used as global variable in 'the_content' filters $content = apply_filters('the_content', $content); // run remaining Wordpress filters such as paragraph tags. unset($GLOBALS['tempPost']); } else { // Only apply default WP filters. This is the safe way to go so we don't risk any plugin injection/overrides of 'the_content' $content = wptexturize($content); $content = convert_smilies($content); $content = convert_chars($content); if (!wpautop_filter($id)) { $content = wpautop($content); // Add paragraph tags. } $content = shortcode_unautop($content); $content = prepend_attachment($content); $content = do_shortcode($content); } // Get title, add to output<br /> if ($title) { $content = '<h3 class="content_static pageTitle">' . $page_data->post_title . '</h3>' . $content; } // Apply function specific $content = apply_filters('theme_get_page', $content, $id); return $content; }