diff --git a/inc/custom-header.php b/inc/custom-header.php index aae4e74..7ee219a 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -5,38 +5,41 @@ * @package understrap */ -function understrap_custom_header_setup() { - - /** - * Filter UnderStrap custom-header support arguments. - * - * @since UnderStrap 0.5.2 - * - * @param array $args { - * An array of custom-header support arguments. - * - * @type string $default-image Default image of the header. - * @type string $default_text_color Default color of the header text. - * @type int $width Width in pixels of the custom header image. Default 954. - * @type int $height Height in pixels of the custom header image. Default 1300. - * @type string $wp-head-callback Callback function used to styles the header image and text - * displayed on the blog. - * @type string $flex-height Flex support for height of header. - * } - */ - add_theme_support( 'custom-header', apply_filters( 'understrap_custom_header_args', array( - 'default-image' => get_parent_theme_file_uri( '/img/header.jpg' ), - 'width' => 2000, - 'height' => 1200, - 'flex-height' => true, - ) ) ); - - register_default_headers( array( - 'default-image' => array( - 'url' => '%s/img/header.jpg', - 'thumbnail_url' => '%s/img/header.jpg', - 'description' => __( 'Default Header Image', 'understrap' ), - ), - ) ); -} add_action( 'after_setup_theme', 'understrap_custom_header_setup' ); + +if ( ! function_exists ( 'understrap_custom_header_setup' ) ) { + function understrap_custom_header_setup() { + + /** + * Filter UnderStrap custom-header support arguments. + * + * @since UnderStrap 0.5.2 + * + * @param array $args { + * An array of custom-header support arguments. + * + * @type string $default-image Default image of the header. + * @type string $default_text_color Default color of the header text. + * @type int $width Width in pixels of the custom header image. Default 954. + * @type int $height Height in pixels of the custom header image. Default 1300. + * @type string $wp-head-callback Callback function used to styles the header image and text + * displayed on the blog. + * @type string $flex-height Flex support for height of header. + * } + */ + add_theme_support( 'custom-header', apply_filters( 'understrap_custom_header_args', array( + 'default-image' => get_parent_theme_file_uri( '/img/header.jpg' ), + 'width' => 2000, + 'height' => 1200, + 'flex-height' => true, + ) ) ); + + register_default_headers( array( + 'default-image' => array( + 'url' => '%s/img/header.jpg', + 'thumbnail_url' => '%s/img/header.jpg', + 'description' => __( 'Default Header Image', 'understrap' ), + ), + ) ); + } +} \ No newline at end of file diff --git a/inc/editor.php b/inc/editor.php index 2d4e339..86aafb3 100644 --- a/inc/editor.php +++ b/inc/editor.php @@ -8,58 +8,67 @@ /** * Registers an editor stylesheet for the theme. */ -function understrap_wpdocs_theme_add_editor_styles() { - add_editor_style( 'css/custom-editor-style.min.css' ); -} + add_action( 'admin_init', 'understrap_wpdocs_theme_add_editor_styles' ); +if ( ! function_exists ( 'understrap_wpdocs_theme_add_editor_styles' ) ) { + function understrap_wpdocs_theme_add_editor_styles() { + add_editor_style( 'css/custom-editor-style.min.css' ); + } +} + // Add TinyMCE style formats. add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' ); -function understrap_tiny_mce_style_formats( $styles ) { +if ( ! function_exists ( 'understrap_tiny_mce_style_formats' ) ) { + function understrap_tiny_mce_style_formats( $styles ) { - array_unshift( $styles, 'styleselect' ); - return $styles; + array_unshift( $styles, 'styleselect' ); + return $styles; + } } + add_filter( 'tiny_mce_before_init', 'understrap_tiny_mce_before_init' ); -function understrap_tiny_mce_before_init( $settings ) { +if ( ! function_exists ( 'understrap_tiny_mce_before_init' ) ) { + function understrap_tiny_mce_before_init( $settings ) { - $style_formats = array( - array( - 'title' => 'Lead Paragraph', - 'selector' => 'p', - 'classes' => 'lead', - 'wrapper' => true - ), - array( - 'title' => 'Small', - 'inline' => 'small' - ), - array( - 'title' => 'Blockquote', - 'block' => 'blockquote', - 'classes' => 'blockquote', - 'wrapper' => true - ), - array( - 'title' => 'Blockquote Footer', - 'block' => 'footer', - 'classes' => 'blockquote-footer', - 'wrapper' => true - ), - array( - 'title' => 'Cite', - 'inline' => 'cite' - ) - ); - - if ( isset( $settings['style_formats'] ) ) { - $orig_style_formats = json_decode($settings['style_formats'],true); - $style_formats = array_merge($orig_style_formats,$style_formats); - } + $style_formats = array( + array( + 'title' => 'Lead Paragraph', + 'selector' => 'p', + 'classes' => 'lead', + 'wrapper' => true + ), + array( + 'title' => 'Small', + 'inline' => 'small' + ), + array( + 'title' => 'Blockquote', + 'block' => 'blockquote', + 'classes' => 'blockquote', + 'wrapper' => true + ), + array( + 'title' => 'Blockquote Footer', + 'block' => 'footer', + 'classes' => 'blockquote-footer', + 'wrapper' => true + ), + array( + 'title' => 'Cite', + 'inline' => 'cite' + ) + ); + + if ( isset( $settings['style_formats'] ) ) { + $orig_style_formats = json_decode($settings['style_formats'],true); + $style_formats = array_merge($orig_style_formats,$style_formats); + } - $settings['style_formats'] = json_encode( $style_formats ); - return $settings; + $settings['style_formats'] = json_encode( $style_formats ); + return $settings; + } } diff --git a/inc/extras.php b/inc/extras.php index 1f6ef01..4789cd7 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -7,6 +7,8 @@ * @package understrap */ +add_filter( 'body_class', 'understrap_body_classes' ); + if ( ! function_exists( 'understrap_body_classes' ) ) { /** * Adds custom classes to the array of body classes. @@ -28,7 +30,6 @@ if ( ! function_exists( 'understrap_body_classes' ) ) { return $classes; } } -add_filter( 'body_class', 'understrap_body_classes' ); // Removes tag class from the body_class array to avoid Bootstrap markup styling issues. add_filter( 'body_class', 'understrap_adjust_body_class' ); @@ -78,8 +79,8 @@ if ( ! function_exists( 'understrap_change_logo_class' ) ) { /** * Display navigation to next/previous post when applicable. */ -if ( ! function_exists( 'understrap_post_nav' ) ) : +if ( ! function_exists ( 'understrap_post_nav' ) ) { function understrap_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); @@ -106,4 +107,4 @@ if ( ! function_exists( 'understrap_post_nav' ) ) : 'main', - 'render' => 'components_infinite_scroll_render', - 'footer' => 'page', - ) ); - // Add theme support for Responsive Videos. - add_theme_support( 'jetpack-responsive-videos' ); - - // Add theme support for Social Menus - add_theme_support( 'jetpack-social-menu' ); - -} add_action( 'after_setup_theme', 'understrap_components_jetpack_setup' ); +if ( ! function_exists ( 'understrap_components_jetpack_setup' ) ) { + function understrap_components_jetpack_setup() { + // Add theme support for Infinite Scroll. + add_theme_support( 'infinite-scroll', array( + 'container' => 'main', + 'render' => 'components_infinite_scroll_render', + 'footer' => 'page', + ) ); + + // Add theme support for Responsive Videos. + add_theme_support( 'jetpack-responsive-videos' ); + + // Add theme support for Social Menus + add_theme_support( 'jetpack-social-menu' ); + + } +} + + /** * Custom render function for Infinite Scroll. */ -function understrap_components_infinite_scroll_render() { - while ( have_posts() ) { - the_post(); - if ( is_search() ) : - get_template_part( 'loop-templates/content', 'search' ); - else : - get_template_part( 'loop-templates/content', get_post_format() ); - endif; + +if ( ! function_exists ( 'understrap_components_infinite_scroll_render' ) ) { + function understrap_components_infinite_scroll_render() { + while ( have_posts() ) { + the_post(); + if ( is_search() ) : + get_template_part( 'loop-templates/content', 'search' ); + else : + get_template_part( 'loop-templates/content', get_post_format() ); + endif; + } } } -function understrap_components_social_menu() { - if ( ! function_exists( 'jetpack_social_menu' ) ) { - return; - } else { - jetpack_social_menu(); +if ( ! function_exists ( 'understrap_components_social_menu' ) ) { + function understrap_components_social_menu() { + if ( ! function_exists( 'jetpack_social_menu' ) ) { + return; + } else { + jetpack_social_menu(); + } } -} +} \ No newline at end of file diff --git a/inc/pagination.php b/inc/pagination.php index 8874fed..c58dfaa 100644 --- a/inc/pagination.php +++ b/inc/pagination.php @@ -5,54 +5,53 @@ * @package understrap */ - if ( ! function_exists( 'understrap_pagination' ) ) : - function understrap_pagination($args = [], $class = 'pagination') { +if ( ! function_exists ( 'understrap_pagination' ) ) { + function understrap_pagination($args = [], $class = 'pagination') { - if ($GLOBALS['wp_query']->max_num_pages <= 1) return; + if ($GLOBALS['wp_query']->max_num_pages <= 1) return; - $args = wp_parse_args( $args, [ - 'mid_size' => 2, - 'prev_next' => false, - 'prev_text' => __('«', 'understrap'), - 'next_text' => __('»', 'understrap'), - 'screen_reader_text' => __('Posts navigation', 'understrap'), - 'type' => 'array', - 'current' => max( 1, get_query_var('paged') ), - ]); + $args = wp_parse_args( $args, [ + 'mid_size' => 2, + 'prev_next' => false, + 'prev_text' => __('«', 'understrap'), + 'next_text' => __('»', 'understrap'), + 'screen_reader_text' => __('Posts navigation', 'understrap'), + 'type' => 'array', + 'current' => max( 1, get_query_var('paged') ), + ]); - $links = paginate_links($args); - $next_link = get_next_posts_page_link(); - $prev_link = get_previous_posts_page_link(); + $links = paginate_links($args); + $next_link = get_next_posts_page_link(); + $prev_link = get_previous_posts_page_link(); - ?> + ?> - + ' . __( 'Read More...', 'understrap' ) . '
'; } -} -add_filter( 'wp_trim_excerpt', 'understrap_all_excerpts_get_more_link' ); +} \ No newline at end of file diff --git a/inc/template-tags.php b/inc/template-tags.php index 3d0141e..7b3a0d2 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -7,105 +7,113 @@ * @package understrap */ -if ( ! function_exists( 'understrap_posted_on' ) ) : + /** * Prints HTML with meta information for the current post-date/time and author. */ -function understrap_posted_on() { - $time_string = ''; - if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { - $time_string = ''; +if ( ! function_exists ( 'understrap_posted_on' ) ) { + function understrap_posted_on() { + $time_string = ''; + if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { + $time_string = ''; + } + $time_string = sprintf( $time_string, + esc_attr( get_the_date( 'c' ) ), + esc_html( get_the_date() ), + esc_attr( get_the_modified_date( 'c' ) ), + esc_html( get_the_modified_date() ) + ); + $posted_on = sprintf( + esc_html_x( 'Posted on %s', 'post date', 'understrap' ), + '' . $time_string . '' + ); + $byline = sprintf( + esc_html_x( 'by %s', 'post author', 'understrap' ), + ' ' + ); + echo '' . $posted_on . ' '; // WPCS: XSS OK. } - $time_string = sprintf( $time_string, - esc_attr( get_the_date( 'c' ) ), - esc_html( get_the_date() ), - esc_attr( get_the_modified_date( 'c' ) ), - esc_html( get_the_modified_date() ) - ); - $posted_on = sprintf( - esc_html_x( 'Posted on %s', 'post date', 'understrap' ), - '' . $time_string . '' - ); - $byline = sprintf( - esc_html_x( 'by %s', 'post author', 'understrap' ), - ' ' - ); - echo '' . $posted_on . ' '; // WPCS: XSS OK. } -endif; -if ( ! function_exists( 'understrap_entry_footer' ) ) : + /** * Prints HTML with meta information for the categories, tags and comments. */ -function understrap_entry_footer() { - // Hide category and tag text for pages. - if ( 'post' === get_post_type() ) { - /* translators: used between list items, there is a space after the comma */ - $categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) ); - if ( $categories_list && understrap_categorized_blog() ) { - printf( '' . esc_html__( 'Posted in %1$s', 'understrap' ) . '', $categories_list ); // WPCS: XSS OK. +if ( ! function_exists ( 'understrap_entry_footer' ) ) { + function understrap_entry_footer() { + // Hide category and tag text for pages. + if ( 'post' === get_post_type() ) { + /* translators: used between list items, there is a space after the comma */ + $categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) ); + if ( $categories_list && understrap_categorized_blog() ) { + printf( '' . esc_html__( 'Posted in %1$s', 'understrap' ) . '', $categories_list ); // WPCS: XSS OK. + } + /* translators: used between list items, there is a space after the comma */ + $tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) ); + if ( $tags_list ) { + printf( ' ', $tags_list ); // WPCS: XSS OK. + } } - /* translators: used between list items, there is a space after the comma */ - $tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) ); - if ( $tags_list ) { - printf( ' ', $tags_list ); // WPCS: XSS OK. + if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { + echo ''; + comments_popup_link( esc_html__( 'Leave a comment', 'understrap' ), esc_html__( '1 Comment', 'understrap' ), esc_html__( '% Comments', 'understrap' ) ); + echo ''; } + edit_post_link( + sprintf( + /* translators: %s: Name of current post */ + esc_html__( 'Edit %s', 'understrap' ), + the_title( '"', '"', false ) + ), + '', + '' + ); } - if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { - echo ''; - comments_popup_link( esc_html__( 'Leave a comment', 'understrap' ), esc_html__( '1 Comment', 'understrap' ), esc_html__( '% Comments', 'understrap' ) ); - echo ''; - } - edit_post_link( - sprintf( - /* translators: %s: Name of current post */ - esc_html__( 'Edit %s', 'understrap' ), - the_title( '"', '"', false ) - ), - '', - '' - ); } -endif; + /** * Returns true if a blog has more than 1 category. * * @return bool */ -function understrap_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'understrap_categories' ) ) ) { - // Create an array of all the categories that are attached to posts. - $all_the_cool_cats = get_categories( array( - 'fields' => '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. - $all_the_cool_cats = count( $all_the_cool_cats ); - set_transient( 'understrap_categories', $all_the_cool_cats ); - } - if ( $all_the_cool_cats > 1 ) { - // This blog has more than 1 category so components_categorized_blog should return true. - return true; - } else { - // This blog has only 1 category so components_categorized_blog should return false. - return false; +if ( ! function_exists ( 'understrap_categorized_blog' ) ) { + function understrap_categorized_blog() { + if ( false === ( $all_the_cool_cats = get_transient( 'understrap_categories' ) ) ) { + // Create an array of all the categories that are attached to posts. + $all_the_cool_cats = get_categories( array( + 'fields' => '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. + $all_the_cool_cats = count( $all_the_cool_cats ); + set_transient( 'understrap_categories', $all_the_cool_cats ); + } + if ( $all_the_cool_cats > 1 ) { + // This blog has more than 1 category so components_categorized_blog should return true. + return true; + } else { + // This blog has only 1 category so components_categorized_blog should return false. + return false; + } } } + /** * Flush out the transients used in understrap_categorized_blog. */ -function understrap_category_transient_flusher() { - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { - return; - } - // Like, beat it. Dig? - delete_transient( 'understrap_categories' ); -} add_action( 'edit_category', 'understrap_category_transient_flusher' ); add_action( 'save_post', 'understrap_category_transient_flusher' ); +if ( ! function_exists ( 'understrap_category_transient_flusher' ) ) { + function understrap_category_transient_flusher() { + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { + return; + } + // Like, beat it. Dig? + delete_transient( 'understrap_categories' ); + } +} \ No newline at end of file diff --git a/inc/theme-settings.php b/inc/theme-settings.php index c7ab6e0..f91d8f1 100755 --- a/inc/theme-settings.php +++ b/inc/theme-settings.php @@ -6,7 +6,7 @@ * */ -if ( ! function_exists( 'understrap_setup_theme_default_settings' ) ) : +if ( ! function_exists ( 'understrap_setup_theme_default_settings' ) ) { function understrap_setup_theme_default_settings() { // check if settings are set, if not set defaults. @@ -29,4 +29,4 @@ if ( ! function_exists( 'understrap_setup_theme_default_settings' ) ) : set_theme_mod( 'understrap_container_type', 'container' ); } } -endif; +} \ No newline at end of file diff --git a/inc/widgets.php b/inc/widgets.php index 54337b8..668b6a0 100644 --- a/inc/widgets.php +++ b/inc/widgets.php @@ -44,6 +44,8 @@ if ( ! function_exists( 'understrap_slbd_count_widgets' ) ) { } } +add_action( 'widgets_init', 'understrap_widgets_init' ); + if ( ! function_exists( 'understrap_widgets_init' ) ) { /** * Initializes themes widgets. @@ -100,6 +102,4 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { ) ); } -} // endif function_exists( 'understrap_widgets_init' ). -add_action( 'widgets_init', 'understrap_widgets_init' ); - +} // endif function_exists( 'understrap_widgets_init' ). \ No newline at end of file diff --git a/inc/woocommerce.php b/inc/woocommerce.php index 17da035..d87d831 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -4,6 +4,8 @@ * * @package understrap */ + + add_action( 'after_setup_theme', 'understrap_woocommerce_support' ); if ( ! function_exists( 'understrap_woocommerce_support' ) ) { /** @@ -22,6 +24,7 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) { } } + /** * First unhook the WooCommerce wrappers */ @@ -54,6 +57,7 @@ function understrap_woocommerce_wrapper_end() { } } + /** * Filter hook function monkey patching form classes * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826 @@ -64,72 +68,74 @@ function understrap_woocommerce_wrapper_end() { * * @return mixed */ -function understrap_wc_form_field_args( $args, $key, $value = null ) { - // Start field type switch case. - switch ( $args['type'] ) { - /* Targets all select input type elements, except the country and state select input types */ - case 'select' : - // Add a class to the field's html element wrapper - woocommerce - // input types (fields) are often wrapped within a tag. - $args['class'][] = 'form-group'; - // Add a class to the form input itself. - $args['input_class'] = array( 'form-control', 'input-lg' ); - $args['label_class'] = array( 'control-label' ); - $args['custom_attributes'] = array( - 'data-plugin' => 'select2', - 'data-allow-clear' => 'true', - 'aria-hidden' => 'true', - // Add custom data attributes to the form input itself. - ); - break; - // By default WooCommerce will populate a select with the country names - $args - // defined for this specific input type targets only the country select element. - case 'country' : - $args['class'][] = 'form-group single-country'; - $args['label_class'] = array( 'control-label' ); - break; - // By default WooCommerce will populate a select with state names - $args defined - // for this specific input type targets only the country select element. - case 'state' : - // Add class to the field's html element wrapper. - $args['class'][] = 'form-group'; - // add class to the form input itself. - $args['input_class'] = array( '', 'input-lg' ); - $args['label_class'] = array( 'control-label' ); - $args['custom_attributes'] = array( - 'data-plugin' => 'select2', - 'data-allow-clear' => 'true', - 'aria-hidden' => 'true', - ); - break; - case 'password' : - case 'text' : - case 'email' : - case 'tel' : - case 'number' : - $args['class'][] = 'form-group'; - $args['input_class'] = array( 'form-control', 'input-lg' ); - $args['label_class'] = array( 'control-label' ); - break; - case 'textarea' : - $args['input_class'] = array( 'form-control', 'input-lg' ); - $args['label_class'] = array( 'control-label' ); - break; - case 'checkbox' : - $args['label_class'] = array( 'custom-control custom-checkbox' ); - $args['input_class'] = array( 'custom-control-input', 'input-lg' ); - break; - case 'radio' : - $args['label_class'] = array( 'custom-control custom-radio' ); - $args['input_class'] = array( 'custom-control-input', 'input-lg' ); - break; - default : - $args['class'][] = 'form-group'; - $args['input_class'] = array( 'form-control', 'input-lg' ); - $args['label_class'] = array( 'control-label' ); - break; - } // end switch ($args). - return $args; +if ( ! function_exists ( 'understrap_wc_form_field_args' ) ) { + function understrap_wc_form_field_args( $args, $key, $value = null ) { + // Start field type switch case. + switch ( $args['type'] ) { + /* Targets all select input type elements, except the country and state select input types */ + case 'select' : + // Add a class to the field's html element wrapper - woocommerce + // input types (fields) are often wrapped within a tag. + $args['class'][] = 'form-group'; + // Add a class to the form input itself. + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + $args['custom_attributes'] = array( + 'data-plugin' => 'select2', + 'data-allow-clear' => 'true', + 'aria-hidden' => 'true', + // Add custom data attributes to the form input itself. + ); + break; + // By default WooCommerce will populate a select with the country names - $args + // defined for this specific input type targets only the country select element. + case 'country' : + $args['class'][] = 'form-group single-country'; + $args['label_class'] = array( 'control-label' ); + break; + // By default WooCommerce will populate a select with state names - $args defined + // for this specific input type targets only the country select element. + case 'state' : + // Add class to the field's html element wrapper. + $args['class'][] = 'form-group'; + // add class to the form input itself. + $args['input_class'] = array( '', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + $args['custom_attributes'] = array( + 'data-plugin' => 'select2', + 'data-allow-clear' => 'true', + 'aria-hidden' => 'true', + ); + break; + case 'password' : + case 'text' : + case 'email' : + case 'tel' : + case 'number' : + $args['class'][] = 'form-group'; + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + case 'textarea' : + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + case 'checkbox' : + $args['label_class'] = array( 'custom-control custom-checkbox' ); + $args['input_class'] = array( 'custom-control-input', 'input-lg' ); + break; + case 'radio' : + $args['label_class'] = array( 'custom-control custom-radio' ); + $args['input_class'] = array( 'custom-control-input', 'input-lg' ); + break; + default : + $args['class'][] = 'form-group'; + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + } // end switch ($args). + return $args; + } } @@ -137,7 +143,10 @@ function understrap_wc_form_field_args( $args, $key, $value = null ) { * Change loop add-to-cart button class to Bootstrap */ add_filter( 'woocommerce_loop_add_to_cart_args', 'understrap_woocommerce_add_to_cart_args', 10, 2 ); -function understrap_woocommerce_add_to_cart_args( $args, $product ) { - $args['class'] = str_replace('button','btn btn-outline-primary', 'button'); - return $args; -} + +if ( ! function_exists ( 'understrap_woocommerce_add_to_cart_args' ) ) { + function understrap_woocommerce_add_to_cart_args( $args, $product ) { + $args['class'] = str_replace('button','btn btn-outline-primary', 'button'); + return $args; + } +} \ No newline at end of file diff --git a/inc/wpcom.php b/inc/wpcom.php index 715195d..16b6dc0 100644 --- a/inc/wpcom.php +++ b/inc/wpcom.php @@ -12,29 +12,36 @@ * * @global array $themecolors */ -function understrap_wpcom_setup() { - global $themecolors; - - // Set theme colors for third party services. - if ( ! isset( $themecolors ) ) { - $themecolors = array( - 'bg' => '', - 'border' => '', - 'text' => '', - 'link' => '', - 'url' => '', - ); - } - - /* Add WP.com print styles */ - add_theme_support( 'print-styles' ); -} add_action( 'after_setup_theme', 'understrap_wpcom_setup' ); +if ( ! function_exists ( 'understrap_wpcom_setup' ) ) { + function understrap_wpcom_setup() { + global $themecolors; + + // Set theme colors for third party services. + if ( ! isset( $themecolors ) ) { + $themecolors = array( + 'bg' => '', + 'border' => '', + 'text' => '', + 'link' => '', + 'url' => '', + ); + } + + /* Add WP.com print styles */ + add_theme_support( 'print-styles' ); + } +} + + /* * WordPress.com-specific styles */ -function understrap_wpcom_styles() { - wp_enqueue_style( 'understrap-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20160411' ); -} add_action( 'wp_enqueue_scripts', 'understrap_wpcom_styles' ); + +if ( ! function_exists ( 'understrap_wpcom_styles' ) ) { + function understrap_wpcom_styles() { + wp_enqueue_style( 'understrap-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20160411' ); + } +} \ No newline at end of file