esc_html__( 'Shop Page / WooCommerce', 'joyas-storefront' ),
'id' => 'shop-page',
'description' => esc_html__( 'Add widgets here.', 'joyas-storefront' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'joyas_storefront_widgets_init',99 );
endif;
if( !function_exists('joyas_storefront_disable_from_parent') ):
add_action('init','joyas_storefront_disable_from_parent',10);
function joyas_storefront_disable_from_parent(){
global $joyas_shop_header_layout;
remove_action('joyas_shop_site_header', array( $joyas_shop_header_layout, 'site_header_layout' ), 30 );
global $joyas_shop_post_related;
remove_action('joyas_shop_site_content_type', array( $joyas_shop_post_related, 'site_loop_heading' ), 10 );
global $joyas_shop_post_related;
remove_action('joyas_shop_loop_navigation', array( $joyas_shop_post_related, 'site_loop_navigation' ), 10 );
remove_action( 'woocommerce_before_main_content', 'joyas_shop_woocommerce_wrapper_before' );
remove_action( 'woocommerce_after_main_content', 'joyas_shop_woocommerce_wrapper_after' );
}
endif;
if( !function_exists('joyas_storefront_header_layout') ) :
function joyas_storefront_header_layout(){
?>
'title',
'order' => 'ASC',
'parent' => 0,
'taxonomy' => 'type',
);
$product_categories = get_terms( 'product_cat', $args );
$count = count($product_categories);
if ( $count > 0 ) :
echo '';
endif;
}
}
add_action( 'joyas_storefront_woocommerce_product_category', 'joyas_storefront_woocommerce_product_category' );
if ( ! function_exists( 'joyas_storefront_woocommerce_wrapper_before' ) ) {
/**
* Before Content.
*
* Wraps all WooCommerce content in wrappers which match the theme markup.
*
* @return void
*/
function joyas_storefront_woocommerce_wrapper_before() {
/**
* Hook - joyas_shop_container_wrap_start
*
* @hooked joyas_shop_container_wrap_start - 5
*/
if( is_product() ){
do_action( 'joyas_shop_container_wrap_start', 'no-sidebar');
}else{
do_action( 'joyas_shop_container_wrap_start', 'sidebar-content');
}
}
add_action( 'woocommerce_before_main_content', 'joyas_storefront_woocommerce_wrapper_before' );
}
if ( ! function_exists( 'joyas_storefront_woocommerce_wrapper_after' ) ) {
/**
* After Content.
*
* Closes the wrapping divs.
*
* @return void
*/
function joyas_storefront_woocommerce_wrapper_after() {
/**
* Hook - joyas_shop_container_wrap_end
*
* @hooked container_wrap_end - 999
*/
if( is_product() ){
do_action( 'joyas_shop_container_wrap_end', 'no-sidebar');
}else{
do_action( 'joyas_shop_container_wrap_end', 'sidebar-content');
}
}
add_action( 'woocommerce_after_main_content', 'joyas_storefront_woocommerce_wrapper_after' );
}
/**
* Default loop columns on product archives.
*
* @return integer products per row.
*/
function joyas_storefront_loop_columns() {
return 3;
}
add_filter( 'loop_shop_columns', 'joyas_storefront_loop_columns', 99);
/**
* Related Products Args.
*
* @param array $args related products args.
* @return array $args related products args.
*/
function joyas_storefront_related_products_args( $args ) {
$defaults = array(
'posts_per_page' => 3,
'columns' => 3,
);
$args = wp_parse_args( $defaults, $args );
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'joyas_storefront_related_products_args', 99 );
add_filter( 'woocommerce_upsell_display_args', 'joyas_storefront_related_products_args', 99 );
add_filter( 'woocommerce_cross_sells_columns', 'joyas_storefront_related_products_args', 99 );
function joyas_storefront_loop_heading() {
if( is_page() ) return;
if ( !is_singular() ) :
the_title( '' );
endif;
}
add_action('joyas_shop_site_content_type', 'joyas_storefront_loop_heading', 10 );
function joyas_storefront_theme_setup(){
// Make theme available for translation.
load_theme_textdomain( 'joyas-storefront', get_stylesheet_directory_uri() . '/languages' );
add_theme_support( 'custom-header', apply_filters( 'farm_store_custom_header_args', array(
'default-image' => get_stylesheet_directory_uri() . '/image/custom-header.jpg',
'default-text-color' => '000000',
'width' => 1000,
'height' => 350,
'flex-height' => true,
'wp-head-callback' => 'joyas_shop_header_style',
) ) );
register_default_headers( array(
'default-image' => array(
'url' => '%s/image/custom-header.jpg',
'thumbnail_url' => '%s/image/custom-header.jpg',
'description' => esc_html__( 'Default Header Image', 'joyas-storefront' ),
),
));
}
add_action( 'after_setup_theme', 'joyas_storefront_theme_setup' );
/**
* Post Posts Loop Navigation
* add_action( 'joyas_loop_navigation', $array( $this,'site_loop_navigation' ) );
* @since 1.0.0
*/
function joyas_storefront_loop_navigation( $type = '' ) {
echo '';
}
add_action('joyas_shop_loop_navigation', 'joyas_storefront_loop_navigation', 20 );
function joyas_storefront_options( $defaults = array() ) {
$defaults['page_layout'] = 'no-sidebar';
return $defaults;
}
add_filter( 'joyas_shop_filter_default_theme_options', 'joyas_storefront_options');