200,
'height' => 200,
'flex-width' => true,
'flex-height' => true,
));
add_theme_support('custom-header', array(
'default-image' => BDM_URI . '/assets/banner_1200x200_v3.png',
'width' => 1200,
'height' => 200,
'flex-height' => false,
));
add_theme_support('custom-background', array(
'default-color' => 'F5F0E8',
));
add_image_size('shelf-thumb', 44, 62, true);
add_image_size('blog-thumb', 100, 68, true);
add_image_size('rev-thumb', 52, 74, true);
add_image_size('book-cover', 130, 185, true);
add_image_size('book-page-cover', 220, 310, true);
add_image_size('series-card', 400, 280, true);
add_image_size('series-header', 1200, 300, true);
register_nav_menus(array(
'primary' => __('Primary Menu', 'bd-murphy'),
'footer' => __('Footer Menu', 'bd-murphy'),
));
register_sidebar(array(
'name' => __('Home Sidebar', 'bd-murphy'),
'id' => 'home-sidebar',
'description' => __('Widget area for the book shelf on the home page', 'bd-murphy'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Footer Left', 'bd-murphy'),
'id' => 'footer-left',
'before_widget' => '',
'after_widget' => '
',
));
register_sidebar(array(
'name' => __('Footer Right', 'bd-murphy'),
'id' => 'footer-right',
'before_widget' => '',
'after_widget' => '
',
));
}
add_action('after_setup_theme', 'bdm_setup');
function bdm_enqueue_assets() {
wp_enqueue_style('bd-murphy-style', get_stylesheet_uri(), array(), BDM_VERSION);
wp_enqueue_style('bd-murphy-google-fonts', 'https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Lato:wght@300;400;700&display=swap', array(), null);
wp_enqueue_script('bd-murphy-navigation', BDM_URI . '/assets/js/navigation.js', array(), BDM_VERSION, true);
wp_enqueue_script('bd-murphy-social-share', BDM_URI . '/assets/js/social-share.js', array(), BDM_VERSION, true);
wp_localize_script('bd-murphy-navigation', 'bdMurphyScreenReaderText', array(
'expand' => __('Expand child menu', 'bd-murphy'),
'collapse' => __('Collapse child menu', 'bd-murphy'),
));
}
add_action('wp_enqueue_scripts', 'bdm_enqueue_assets');
function bdm_enqueue_admin_assets($hook) {
wp_enqueue_style('bd-murphy-admin-style', BDM_URI . '/assets/admin.css', array(), BDM_VERSION);
}
add_action('admin_enqueue_scripts', 'bdm_enqueue_admin_assets');
function bdm_output_customizer_css() {
$primary_color = get_theme_mod('primary_color', '#1B3A6B');
$accent_color = get_theme_mod('accent_color', '#C8A96E');
$cream_color = get_theme_mod('background_color', 'F5F0E8');
$heading_font = get_theme_mod('heading_font', 'Playfair Display');
$body_font = get_theme_mod('body_font', 'Lato');
$slate_blue = bdm_adjust_color($primary_color, 30);
$sky_blue = bdm_adjust_color($primary_color, 80);
echo '' . "\n";
}
add_action('wp_head', 'bdm_output_customizer_css', 99);
function bdm_adjust_color($hex, $percent) {
$hex = ltrim($hex, '#');
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
$r = min(255, max(0, $r + $percent));
$g = min(255, max(0, $g + $percent));
$b = min(255, max(0, $b + $percent));
return sprintf('#%02x%02x%02x', $r, $g, $b);
}
function bdm_publish_hook($post_id) {
do_action('bdm_post_published', $post_id);
}
add_action('publish_post', 'bdm_publish_hook');
add_action('wp_head', function() {
echo '' . "\n";
});