is_customize_preview(), ) ); // Keeping it mostly for other plugins. $font_path = WC()->plugin_url() . '/assets/fonts/'; // WOFF should be enough, keeping the rest for maximum browser-compatibility. $inline_font = '@font-face { font-family: "star"; src: url("' . $font_path . 'star.eot"); src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"), url("' . $font_path . 'star.woff") format("woff"), url("' . $font_path . 'star.ttf") format("truetype"), url("' . $font_path . 'star.svg#star") format("svg"); font-weight: normal; font-style: normal; }'; wp_add_inline_style( 'pen-woocommerce-style', $inline_font ); } add_action( 'wp_enqueue_scripts', 'pen_woocommerce_scripts' ); } if ( ! function_exists( 'pen_woocommerce_class_body' ) ) { /** * Adds WooCommerce-specific classes to the body tag. * * @param array $classes CSS classes applied to the body tag. * * @since Pen 1.2.8 * @return array */ function pen_woocommerce_class_body( $classes ) { $classes[] = 'woocommerce-active'; $classes[] = 'pen_has_woocommerce'; // Keeping it mostly for other plugins. if ( is_shop() || is_product_category() || is_product_tag() ) { $classes[] = 'columns-' . absint( pen_woocommerce_columns() ); } return $classes; } add_filter( 'body_class', 'pen_woocommerce_class_body' ); } if ( ! function_exists( 'pen_woocommerce_class_post' ) ) { /** * Adds custom classes to WooCommerce products. * * @param array $classes CSS classes applied to the body tag. * @param int $product The product ID. * * @since Pen 1.2.8 * @return array $classes */ function pen_woocommerce_class_post( $classes, $product ) { if ( ! pen_is_singular() ) { $content_id = pen_post_id(); $classes = pen_post_classes( $classes, $content_id, 'return_array', false ); } return $classes; } add_filter( 'woocommerce_post_class', 'pen_woocommerce_class_post', 10, 2 ); } if ( ! function_exists( 'pen_content_per_page_products' ) ) { /** * Products per page. * * @since Pen 1.2.8 * @return integer number of products. */ function pen_content_per_page_products() { return (int) pen_option_get( 'content_per_page_products' ); } add_filter( 'loop_shop_per_page', 'pen_content_per_page_products' ); } if ( ! function_exists( 'pen_woocommerce_archive_title' ) ) { /** * Overrides archive titles. * * @param string $title Archive title. * * @since Pen 1.2.8 * @return string */ function pen_woocommerce_archive_title( $title ) { if ( is_shop() && wc_get_page_id( 'shop' ) === $shop_id ) { $title = get_the_title( $shop_id ); } return $title; } add_filter( 'get_the_archive_title', 'pen_woocommerce_archive_title' ); } if ( ! function_exists( 'pen_woocommerce_columns' ) ) { /** * Overrides number of columns. * * @since Pen 1.2.8 * @return integer */ function pen_woocommerce_columns() { $content_id = pen_post_id(); $columns = 4; $list_type = pen_list_type( $content_id ); if ( 'masonry' === $list_type || 'tiles' === $list_type ) { $type = ( ( 'tiles' === $list_type ) ? 'tile' : $list_type ); $columns = (int) pen_option_get( 'list_' . $type . '_columns' ); } return $columns; } add_filter( 'loop_shop_columns', 'pen_woocommerce_columns' ); } if ( ! function_exists( 'pen_woocommerce_summaries' ) ) { /** * Product descriptions. * * @since Pen 1.2.8 * @return void */ function pen_woocommerce_product_summary() { $content_id = pen_post_id(); $view = pen_is_singular() ? 'content' : 'list'; $thumbnail_display = get_post_meta( $content_id, 'pen_' . $view . '_thumbnail_display_override', true ); if ( ! $thumbnail_display || 'default' === $thumbnail_display ) { $thumbnail_display = pen_option_get( $view . '_thumbnail_display' ); } $classes = array( 'pen_content', 'p-' . $content_id, pen_class_lists( 'summary_display_override', $content_id ), $thumbnail_display ? 'pen_with_thumbnail' : 'pen_without_thumbnail', ); $classes = implode( ' ', array_filter( $classes ) ); $list_excerpt_display = pen_option_get( 'list_excerpt' ); ob_start(); // get_the_content() does not support shortcodes etc. if ( 'list' === $view || ! $list_excerpt_display ) { the_content(); } elseif ( 'content' === $view && $list_excerpt_display ) { the_excerpt(); } $summary = trim( ob_get_clean() ); $length = 15; if ( 'list' === $view ) { $length = 30; } $summary = wp_trim_words( $summary, $length ); ob_start(); ?>