/** * Disable Inline Comments on various pages. * * Currently disabled on: * - BuddyPress pages * - Social Paper archive page */ function cacsp_ic_disable() { $disable = false; if (function_exists('is_buddypress') && true === is_buddypress() || true === cacsp_is_archive()) { $disable = true; } if (is_singular('cacsp_paper') && 'auto-draft' === get_post_status()) { $disable = true; } if (false === $disable) { return; } /** * Since IC runs their code on 'init', we have to remove each hook * individually on 'wp' ('bp_ready') using our utility function, * {@link remove_anonymous_object_filter()} to do so. * * @see initialize_incom_wp() * @see initialize_incom_comments() */ remove_anonymous_object_filter('wp_enqueue_scripts', 'INCOM_WordPress', 'incom_enqueue_scripts'); remove_anonymous_object_filter('wp_footer', 'INCOM_WordPress', 'load_incom'); remove_anonymous_object_filter('wp_enqueue_scripts', 'INCOM_WordPress', 'load_incom_style'); remove_anonymous_object_filter('wp_head', 'INCOM_WordPress', 'load_custom_css'); remove_anonymous_object_filter('wp_footer', 'INCOM_Comments', 'generateCommentsAndForm'); }
/** * Clears the buffer for content replacement on the Social Paper archive page. * * This is also where we call our custom directory template. * * @access private * * @param WP_Query $q */ function _cacsp_archive_ob_end($q) { if (false === Social_Paper::$is_buffer) { return; } if (false === cacsp_is_archive()) { return; } ob_end_clean(); remove_action('loop_end', '_cacsp_archive_ob_end', 999); // rewind posts if papers exist to display them in our template if (false === Social_Paper::$is_empty_archive) { $q->rewind_posts(); } $templates = array(); if (function_exists('buddypress')) { $templates[] = 'content-directory-social-paper-buddypress.php'; } $templates[] = 'content-directory-social-paper.php'; cacsp_locate_template($templates, true); }