__('Home Slider','the-business-wp'), 'hero'=> __('Hero','the-business-wp'), 'service'=> __('Service','the-business-wp'), 'woocommerce'=> __('Shop','the-business-wp'), 'callout'=> __('Callout','the-business-wp'), 'team'=> __('Team','the-business-wp'), 'skills'=> __('Skills','the-business-wp'), 'testimonial'=> __('Testimonial','the-business-wp'), 'news'=> __('News','the-business-wp'), 'contact'=> __('Contact','the-business-wp'), 'none'=> __('None','the-business-wp'), ); return $featured; } endif; if ( ! function_exists( 'the_business_wp_color_codes' ) ) : /** * the-business-wp color codes * @package the-business-wp * @since 1.0 */ function the_business_wp_color_codes(){ return array('#000000','#ffffff','#ED0A70','#e7ad24','#FFD700','#81d742','#0053f9','#8224e3'); } endif; if ( ! function_exists( 'the_business_wp_background_style' ) ) : /** * the-business-wp color codes * @package the-business-wp * @since 1.0 */ function the_business_wp_background_style(){ return array( 'no-repeat' => __('No Repeat','the-business-wp'), 'repeat' => __('Tile','the-business-wp'), 'repeat-x' => __('Tile Horizontally','the-business-wp'), 'repeat-y' => __('Tile Vertically','the-business-wp'), ); } endif; /** * @Package twentyseventeen * @subpackage the-business-wp * @since the-business-wp 1.0 */ if ( ! function_exists( 'the_business_wp_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function the_business_wp_posted_on() { $byline = sprintf( // Get the author name; wrap it in a link. esc_html_x( 'By %s', 'post author', 'the-business-wp' ), '' . esc_html( get_the_author() ) . '' ); // Finally, let's write all of this to the page. echo '' . the_business_wp_time_link() . ' ' . $byline . ''; } endif; /** * @Package twentyseventeen * @subpackage the-business-wp * @since the-business-wp 1.0 */ if ( ! function_exists( 'the_business_wp_time_link' ) ) : /** * Gets a nicely formatted string for the published date. */ function the_business_wp_time_link() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, get_the_date( DATE_W3C ), get_the_date(), get_the_modified_date( DATE_W3C ), get_the_modified_date() ); $args = array( 'time'=> array('class'=> array(),'datetime'=>array())); $time_string = wp_kses($time_string, $args); // Wrap the time string in a link, and preface it with 'Posted on'. return sprintf( /* translators: %s: post date */ __( 'Posted on %s', 'the-business-wp' ), '' .$time_string. '' ); } endif; /** * @Package twentyseventeen * @subpackage the-business-wp * @since the-business-wp 1.0 */ if ( ! function_exists( 'the_business_wp_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function the_business_wp_entry_footer() { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'the-business-wp' ) ); /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'the-business-wp' ) ); // We don't want to output .entry-footer if it will be empty, so make sure its not. if ( ( ( the_business_wp_categorized_blog() && $categories_list ) || $tags_list ) || get_edit_post_link() ) { echo ' '; } } endif; /** * @Package twentyseventeen * @subpackage the-business-wp * @since the-business-wp 1.0 */ if ( ! function_exists( 'the_business_wp_edit_link' ) ) : /** * Returns an accessibility-friendly link to edit a post or page. * Helpful when/if the single-page * layout with multiple posts/pages shown gets confusing. */ function the_business_wp_edit_link() { edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'the-business-wp' ), the_title( '"', '"', false ) ), '', '' ); } endif; if ( ! function_exists( 'the_business_wp_woo_products' ) ){ /** * Displays list of woocommerce products in front page * */ function the_business_wp_woo_products( $products_show, $show_featured=false ) { if(!class_exists( 'WooCommerce' )){return;} //woocommerce products are custom posts named product $args = array( 'post_type' => 'product', ); if (empty( $products_show )){ $args['posts_per_page']= $products_show ; } else{ $args['posts_per_page']= 4 ; } //if show featured pages if($show_featured){ $args = array( 'post_type' => 'product', 'posts_per_page' => $args['posts_per_page'], 'tax_query' => array( array( 'taxonomy' => 'product_visibility', 'field' => 'name', 'terms' => 'featured', ), ), ); } $loop = new WP_Query( $args ); if ( $loop->have_posts() ) : $i = 1; while ( $loop->have_posts() ) : $loop->the_post(); global $product; global $post; ?>
'; } $i++; endwhile; wp_reset_postdata(); endif; } } if ( ! function_exists( 'the_business_wp_free_checkout_fields' ) ) : /** * Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment. */ function the_business_wp_free_checkout_fields() { if (!class_exists( 'WooCommerce' ) ) {return;} // first, bail if the cart needs payment, we don't want to do anything if ( WC()->cart && WC()->cart->needs_payment() ) { return; } // now continue only if we're at checkout // is_checkout() was broken as of WC 3.2 in ajax context, double-check for is_ajax if ( function_exists( 'is_checkout' ) && ( is_checkout() || is_ajax() ) ) { // remove coupon forms since why would you want a coupon for a free cart?? remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); // Remove the "Additional Info" order notes add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); // Unset the fields we don't want in a free checkout function the_business_wp_unset_unwanted_checkout_fields( $fields ) { // add or remove billing fields you do not want // fields: http://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-2 $billing_keys = array( 'billing_first_name', 'billing_last_name', 'billing_email', 'billing_company', 'billing_company', 'billing_phone', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_postcode', 'billing_country', 'billing_state', ); // unset each of those unwanted fields foreach( $billing_keys as $key ) { unset( $fields['billing'][ $key ] ); } return $fields; } add_filter( 'woocommerce_checkout_fields', 'the_business_wp_unset_unwanted_checkout_fields' ); } } endif; //remove some free checkout feelds for free products global $the_business_wp_option; if(class_exists( 'WooCommerce' ) && $the_business_wp_option['woocommerce_free_checkout_feelds']){ add_action( 'wp', 'the_business_wp_free_checkout_fields' ); } /** * Woocommerce Custom add to cart button * */ if ( ! function_exists( 'the_business_wp_add_to_cart' ) ) { function the_business_wp_add_to_cart() { if(!class_exists( 'WooCommerce' )){return;} global $product; if ( function_exists( 'method_exists' ) && method_exists( $product, 'get_type' ) ) { $prod_type = $product->get_type(); } else { $prod_type = $product->product_type; } if ( function_exists( 'method_exists' ) && method_exists( $product, 'get_stock_status' ) ) { $prod_in_stock = $product->get_stock_status(); } else { $prod_in_stock = $product->is_in_stock(); } if ( $product ) { $args = array(); $defaults = array( 'quantity' => 1, 'class' => implode( ' ', array_filter( array( 'button', 'product_type_' . $prod_type, $product->is_purchasable() && $prod_in_stock ? 'add_to_cart_button' : '', $product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '', ) ) ), ); $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product ); wc_get_template( 'woocommerce/add-to-cart.php', $args ); } } } if ( ! function_exists( 'the_business_wp_wc_custom_get_price_html' ) ) : /* when price empty return 0$ */ function the_business_wp_wc_custom_get_price_html( $price, $product ) { if(!class_exists( 'WooCommerce' )){return;} if ( $product->get_price() == 0 ) { if ( $product->is_on_sale() && $product->get_regular_price() ) { $regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) ); $price = wc_format_price_range( $regular_price, __( 'Free!', 'the-business-wp' ) ); } else { $price = '' . __( 'Free!', 'the-business-wp' ) . ''; } } return $price; } endif; add_filter( 'woocommerce_get_price_html', 'the_business_wp_wc_custom_get_price_html', 10, 2 ); /** * Add Cart icon and count to header if WC is active */ function the_business_wp_wc_cart_count() { if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { //$count = WC()->cart->cart_contents_count; $count = WC()->cart->get_cart_total(); ?> 0 cart->cart_contents_count; ?> 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, ) ); // Count the number of categories that are attached to the posts. $category_count = count( $categories ); set_transient( 'the_business_wp_categories', $category_count ); } // Allow viewing case of 0 or 1 categories in post preview. if ( is_preview() ) { return true; } return $category_count > 1; } /** * Flush out the transients used in the_business_wp_categorized_blog. * @Package twentyseventeen * @subpackage the-business-wp * @since the-business-wp 1.0 */ function the_business_wp_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'the_business_wp_categories' ); } add_action( 'edit_category', 'the_business_wp_category_transient_flusher' ); add_action( 'save_post', 'the_business_wp_category_transient_flusher' ); if ( ! function_exists( 'the_business_wp_font_family' ) ) : function the_business_wp_font_family(){ $google_fonts = array("Open Sans" => "Open Sans", "Oswald" => "Oswald", "PT Sans" => "PT Sans", "Times New Roman, Sans Serif" => "Times New Roman, Sans Serif"); return $google_fonts; } endif; function the_business_wp_footer_foreground_css(){ $color = esc_attr(get_theme_mod( 'footer_foreground_color','#fff')) ; $theme_color = '#2d89ef'; if ( 'default' == get_theme_mod( 'colorscheme','default' )) { $theme_color = esc_attr(get_theme_mod( 'colorscheme_color','#2d89ef')) ; } /** * * @since business-wp 1.0 * */ $css = ' .footer-foreground {} .footer-foreground .widget-title, .footer-foreground a, .footer-foreground p, .footer-foreground li, .footer-foreground table, .footer-foreground .widget { color:'.$color.'; } .footer-foreground a:hover, .footer-foreground a:active {color:'.$theme_color.';} '; return $css; }