コード例 #1
0
 public function is_enterprise()
 {
     return function_exists('Enterprise') && method_exists(Enterprise(), 'is_enabled') && Enterprise()->is_enabled();
 }
コード例 #2
0
/**
 * Auto-apply Co-Authors Plus template tags on themes that are properly using the_author()
 * and the_author_posts_link()
 * Auto-apply Co-Authors Plus in oembed endpoint
 */
$wpcom_coauthors_plus_auto_apply_themes = array('premium/portfolio', 'premium/zuki', 'pub/editor');
if (in_array(get_option('template'), $wpcom_coauthors_plus_auto_apply_themes) || true === defined('WPCOM_VIP_IS_OEMBED') && true === constant('WPCOM_VIP_IS_OEMBED') && true === apply_filters('wpcom_vip_coauthors_replace_oembed', false, 'author_name')) {
    add_filter('coauthors_auto_apply_template_tags', '__return_true');
}
/**
 * If Co-Authors Plus is enabled on an Enterprise site and hasn't yet been integrated with the theme
 * show an admin notice
 */
if (function_exists('Enterprise')) {
    if (Enterprise()->is_enabled() && !in_array(get_option('template'), $wpcom_coauthors_plus_auto_apply_themes)) {
        add_action('admin_notices', function () {
            // Allow this to be short-circuted in mu-plugins
            if (!apply_filters('wpcom_coauthors_show_enterprise_notice', true)) {
                return;
            }
            echo '<div class="error"><p>' . __("Co-Authors Plus isn't yet integrated with your theme. Please contact support to make it happen.") . '</p></div>';
        });
    }
}
/**
 * We want to let Elasticsearch know that it should search the author taxonomy's name as a search field
 * See: https://elasticsearchp2.wordpress.com/2015/01/08/in-36757-z-vanguard-says-they/
 *
 * @param $es_wp_query_args The ElasticSearch Query Parameters
 * @param $query