diff --git a/adminfunctions.php b/adminfunctions.php index 9cbf384..422fe8a 100755 --- a/adminfunctions.php +++ b/adminfunctions.php @@ -54,9 +54,16 @@ function foxyshop_load_admin_scripts($hook) { foxyshop_date_picker(); } +//Add filter to allow blocking the CSS on non-product pages +function foxyshop_load_css() { + return apply_filters( 'foxyshop_load_css', true ); +} + //Loading in Public Style function foxyshop_load_site_scripts() { - wp_enqueue_style('foxyshop_css', FOXYSHOP_DIR . '/css/foxyshop.css', array(), FOXYSHOP_VERSION); + if (foxyshop_load_css()) { + wp_enqueue_style('foxyshop_css', FOXYSHOP_DIR . '/css/foxyshop.css', array(), FOXYSHOP_VERSION); + } } //Checking For Includes To Be Removed diff --git a/helperfunctions.php b/helperfunctions.php index fc35a91..892c40f 100755 --- a/helperfunctions.php +++ b/helperfunctions.php @@ -319,8 +319,8 @@ function foxyshop_start_form() { -//Writes Variations (showQuantity 0 = Not Shown, 1 = Above, 2 = Below) -function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = true, $beforeVariation = "", $afterVariation = '
') { +//Writes Variations (showQuantity 0 = Not Shown, 1 = Above, 2 = Below; labelPosition 0 = Before, 1 = Placeholder) +function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = true, $beforeVariation = "", $afterVariation = '', $labelPosition = 0) { global $post, $product, $foxyshop_settings, $foxyshop_write_variation_include; $writeUploadInclude = 0; $write = ""; @@ -330,7 +330,7 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t if ($product['quantity_hide']) $showQuantity = 0; if ($showQuantity == 1) { $write .= foxyshop_get_shipto(); - $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation); + $write .= foxyshop_quantity(apply_filters("foxyshop_default_quantity_value", 1), $beforeVariation, $afterVariation, "", $labelPosition); } //Loop Through Variations @@ -383,15 +383,22 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t $className = "variation-" . sanitize_title_with_dashes($variationName); - $writeBeforeVariation = $beforeVariation ? str_replace("%c", $className, $beforeVariation) . "\n" : ""; - $writeAfterVariation = $afterVariation ? $afterVariation . "\n" : ""; + $writeBeforeVariationEl = $beforeVariation ? str_replace("%c", $className, $beforeVariation) . "\n" : ""; + $writeAfterVariation = $afterVariation ? $afterVariation . "\n" : ""; $writeAfterVariationEl = $afterVariation ? $afterVariation . "\n" : ""; + $writeBeforeVariation = apply_filters('foxyshop_before_variation_field', $writeBeforeVariationEl, $variationName); + $writeAfterVariation = apply_filters('foxyshop_after_variation_field', $writeAfterVariationEl, $variationName); if ($variationRequired) $className .= ' foxyshop_required'; //Text if ($variationType == "text") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= '' . esc_attr(str_replace('_',' ',$variationDisplayName)) . ''."\n"; + $write .= ' 0) $write .= ' style="width: ' . (int)$arrVariationText[0] * 6.5 . 'px;"'; if ($variationDisplayKey) $write .= ' dkey="' . $variationDisplayKey . '"'; if ($arrVariationText[1]) $write .= ' maxlength="' . $arrVariationText[1] . '"'; @@ -401,8 +408,13 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t //Textarea } elseif ($variationType == "textarea") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= ''."\n"; + if ($labelPosition == 0) { + $write .= ''."\n"; + $write .= ''."\n"; + } + else if ($labelPosition == 1) { + $write .= ''."\n"; + } $write .= $writeAfterVariation; //Upload @@ -430,8 +442,14 @@ function foxyshop_product_variations($showQuantity = 0, $showPriceVariations = t //Select if ($variationType == "dropdown") { $write .= $writeBeforeVariation; - $write .= ''."\n"; - $write .= '