コード例 #1
0
function amt_detect_ecommerce_product_group()
{
    // Get the options the DB
    $options = get_option("add_meta_tags_opts");
    // Only product groups that validate as custom taxonomies are supported
    if (!is_tax()) {
        return false;
    }
    // WooCommerce product group
    if ($options["extended_support_woocommerce"] == "1" && amt_is_woocommerce_product_group()) {
        add_filter('amt_taxonomy_force_image_url', 'amt_product_group_image_url_woocommerce', 10, 2);
        return true;
        // Easy-Digital-Downloads product group
    } elseif ($options["extended_support_edd"] == "1" && amt_is_edd_product_group()) {
        return true;
    }
    return false;
}
コード例 #2
0
function amt_detect_ecommerce_product_group($default)
{
    // First and important check.
    // $default is a boolean variable which indicates if custom content has been
    // detected by any previous filter.
    // Check if custom content has already been detected by another filter.
    // If such content has been detected, just return $default (should be true)
    // and *do not* add any metadata filters.
    // This check is mandatory in order the detection mechanism to work correctly.
    if ($default) {
        return $default;
    }
    // Get the options the DB
    $options = get_option("add_meta_tags_opts");
    // Only product groups that validate as custom taxonomies are supported
    if (!is_tax()) {
        return false;
    }
    // WooCommerce product group
    if ($options["extended_support_woocommerce"] == "1" && amt_is_woocommerce_product_group()) {
        add_filter('amt_taxonomy_force_image_url', 'amt_product_group_image_url_woocommerce', 10, 2);
        return true;
        // Easy-Digital-Downloads product group
    } elseif ($options["extended_support_edd"] == "1" && amt_is_edd_product_group()) {
        return true;
    }
    return false;
}