Skip to content

Instantly share code, notes, and snippets.

@lizkaraffa
Created May 26, 2016 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizkaraffa/c824feabe7ee1144269747573ea562e5 to your computer and use it in GitHub Desktop.
Save lizkaraffa/c824feabe7ee1144269747573ea562e5 to your computer and use it in GitHub Desktop.
Current code
<?php
add_action( 'wp_enqueue_scripts' , '_wpsc_te2_enqueue_styles', 1 );
function _wpsc_te2_enqueue_styles() {
wp_register_style( 'wpsc-common', wpsc_locate_asset_uri( 'css/common.css' ), array(), WPSC_VERSION );
do_action( 'wpsc_register_styles' );
wp_enqueue_style( 'wpsc-common' );
if ( apply_filters( 'wpsc_add_inline_style', true ) ) {
wp_add_inline_style( 'wpsc-common', _wpsc_get_inline_style() );
}
function _wpsc_te2_enqueue_styles() {
wp_register_style( 'wpsc-common', wpsc_locate_asset_uri( 'css/common.css' ), array(), WPSC_VERSION );
wp_register_style( 'wpsc-responsive', wpsc_locate_asset_uri( 'css/wpsc-responsive.css' ), array(), WPSC_VERSION );
do_action( 'wpsc_register_styles' );
wpsc_enqueue_style( 'wpsc-common' );
wp_enqueue_style( 'wpsc-responsive' );
wpsc_add_inline_style( 'wpsc-common', _wpsc_get_inline_style() );
do_action( 'wpsc_enqueue_styles' );
}
/**
* Inline style that ensure the product summary's width take the thumbnail width
* into consideration.
*
* @access private
* @since 0.1
*
* @return string CSS output
*/
function _wpsc_get_inline_style() {
$archive_width = get_option( 'product_image_width' );
$single_width = get_option( 'single_view_image_width' );
$tax_width = get_option( 'category_image_width' );
$thumbnail_padding = apply_filters( 'wpsc_thumbnail_padding', 15 );
ob_start();
?>
.wpsc-page-main-store .wpsc-product-summary {
width: -moz-calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
width: -webkit-calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
width: calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
}
.wpsc-page-single .wpsc-product-summary {
width: -moz-calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
width: -webkit-calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
width: calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
}
.wpsc-page-taxonomy .wpsc-product-summary {
width: -moz-calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
width: -webkit-calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
width: calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
}
<?php
return ob_get_clean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment