CHILD THEME: functions.php
written by: Jeff McNearCHILD THEME: functions.php
Technically the only required file is a style.css file, but if you want to take advantage of the existing styles you will need to enqueue them via a functions file
CONNECTING TO THE STOREFRONT PARENT AS THE CHILD
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . /style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
GETTING RID OF THE BREADCRUMBS
//SOURCE: https://atlantisthemes.com/remove-storefront-breadcrumb
add_action( 'init', 'storefront_remove_storefront_breadcrumbs' );
function storefront_remove_storefront_breadcrumbs() {
remove_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
}
CREATING SOME NEW WIDGET REGIONS
function plasterdog_hero_widgets_init() {
register_sidebar( array(
'name' => __( 'Regular Page Sidebar', 'plasterdog-hero' ),
'id' => 'page-sidebar',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>'
) );
register_sidebar( array(
'name' => __( 'Post Sidebar', 'plasterdog-hero' ),
'id' => 'post-sidebar',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>'
) );
}
add_action( 'widgets_init', 'plasterdog_hero_widgets_init' );
REMOVE THE “CATEGORY” PREFIX FROM POST ARCHIVE
add_filter( 'get_the_archive_title', 'replaceCategoryName');
function replaceCategoryName ($title) {
$title = single_cat_title( '', false );
return $title;
}