tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'bizbaby-primary-menu' => esc_html__('Bizbaby Primary Menu', 'bizbaby'),
'bizbaby-onpages-menu' => esc_html__('Bizbaby On Other Pages Menu', 'bizbaby'),
)
);
$menu_primary_exists = wp_get_nav_menu_object('Bizbaby Primary Menu');
$menu_pages_exists = wp_get_nav_menu_object('Bizbaby On Other Pages Menu');
if (!$menu_primary_exists) {
$menu_primary = wp_create_nav_menu('Bizbaby Primary Menu');
wp_update_nav_menu_item($menu_primary, 0, array(
'menu-item-title' => 'About',
'menu-item-url' => '#about',
'menu-item-status' => 'publish'
));
wp_update_nav_menu_item($menu_primary, 0, array(
'menu-item-title' => 'Services',
'menu-item-url' => '#services',
'menu-item-status' => 'publish'
));
wp_update_nav_menu_item($menu_primary, 0, array(
'menu-item-title' => 'Login',
'menu-item-url' => '#login',
'menu-item-status' => 'publish',
));
}
if (!$menu_pages_exists) {
$menu_pages = wp_create_nav_menu('Bizbaby On Other Pages Menu');
wp_update_nav_menu_item($menu_pages, 0, array(
'menu-item-title' => 'About',
'menu-item-url' => home_url().'/#about',
'menu-item-status' => 'publish'
));
wp_update_nav_menu_item($menu_pages, 0, array(
'menu-item-title' => 'Services',
'menu-item-url' => home_url().'/#services',
'menu-item-status' => 'publish'
));
wp_update_nav_menu_item($menu_pages, 0, array(
'menu-item-title' => 'Login',
'menu-item-url' => home_url().'#login',
'menu-item-status' => 'publish',
));
}
if ($menu_pages_exists) {
set_theme_mod('nav_menu_locations', array(
'bizbaby-onpages-menu' => $menu_pages_exists->term_id,
));
}
if ($menu_primary_exists) {
set_theme_mod('nav_menu_locations', array(
'bizbaby-primary-menu' => $menu_primary_exists->term_id,
));
}
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
)
);
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
add_theme_support("wp-block-styles");
add_theme_support("responsive-embeds");
add_theme_support("align-wide");
add_theme_support('editor-style');
add_theme_support("custom-background", []);
register_block_pattern(
'bizbaby/contact-form',
array(
'title' => 'Bizbaby contact form',
'content' => "
",
)
);
add_editor_style();
register_block_style(
'core/quote',
array(
'name' => 'blue-quote',
'label' => __('Blue Quote', 'bizbaby'),
'inline_style' => '.wp-block-quote.is-style-blue-quote { color: blue; }',
)
);
}
add_action('after_setup_theme', 'bizbaby_setup');
function bizbaby_widgets_init()
{
register_sidebar( array(
'name' => 'Home right sidebar',
'id' => 'bizbaby_home_right_1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'bizbaby_widgets_init');
function bizbaby_plugin_is_active() {
return in_array( 'bizbaby/bizbaby.php', get_option( 'active_plugins' ) );
}
function bizbaby_estimate_modal() {
if (bizbaby_plugin_is_active()) {
return get_template_part('template-parts/modals/estimate');
}
return "";
}
function bizbaby_set_default_tagline($value) {
if (empty($value)) {
return 'Building Modern Landscapes since 2012';
}
return $value;
}
add_filter('pre_option_blogdescription', 'bizbaby_set_default_tagline');
function bizbaby_theme_settings($wp_customize)
{
$wp_customize->add_section('bizbaby_settings', array(
'title' => 'Bizbaby theme settings',
'priority' => 30,
));
$wp_customize->add_setting('bizbaby_slogan_option', array(
'default' => 'We are in Seattle Building Modern Landscapes',
'sanitize_callback' => 'wp_kses_post',
));
$wp_customize->add_control('bizbaby_slogan_option', array(
'label' => 'Site slogan',
'section' => 'bizbaby_settings',
'type' => 'textarea',
));
$wp_customize->add_setting('bizbaby_section_title_option', array(
'default' => 'Our Services',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('bizbaby_section_title_option', array(
'label' => 'Page title',
'section' => 'bizbaby_settings',
'type' => 'text'
));
$wp_customize->add_setting('bizbaby_banner_background_image_setting', array(
'default' => bizbaby_image_url('banner.webp'),
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bizbaby_banner_background_image_setting', array(
'label' => 'Main image',
'section' => 'bizbaby_settings',
'settings' => 'bizbaby_banner_background_image_setting',
'type' => 'image',
)));
// shortcodes
$shortcodes_options = get_option('bizbaby_form_shortcodes');
$wp_customize->add_setting('bizbaby_selected_shortcode', array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('bizbaby_selected_shortcode', array(
'label' => 'Header form type',
'section' => 'bizbaby_settings',
'type' => 'select',
'choices' => $shortcodes_options,
));
$wp_customize->add_setting('bizbaby_selected_footer_shortcode', array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('bizbaby_selected_footer_shortcode', array(
'label' => 'Footer form type',
'section' => 'bizbaby_settings',
'type' => 'select',
'choices' => $shortcodes_options,
));
$wp_customize->add_setting('bizbaby_selected_footer_shortcode', array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('bizbaby_selected_footer_shortcode', array(
'label' => 'Footer form type',
'section' => 'bizbaby_settings',
'type' => 'select',
'choices' => $shortcodes_options,
));
$data = [
[
'img' => 'Fences & Gates',
'title' => 'Fences & Gates',
'description' => 'A new fence can add a protection to your home and add value to the overall property.'
],
[
'img' => 'Fences & Gates',
'title' => 'Retaining Walls',
'description' => 'Retaining walls can facelift your home and change the style of your yard and protect it from the weather.'
],
[
'img' => 'Fences & Gates',
'title' => 'Patios',
'description' => 'Custom designed and built patio is a must addition to your dream home. Built to accommodate a couple to a party of 10.'
],
[
'img' => 'Fences & Gates',
'title' => 'Sustainable Landscape Design',
'description' => 'Custom made designs by Seattle Modern Landscapes is the next step towards your dream home.'
],
[
'img' => 'Fences & Gates',
'title' => 'Irrigation',
'description' => 'Keeping your yard fully supplied during spring to fall months and keeping your irrigation system safe from freezing during the winter months.'
],
[
'img' => 'Fences & Gates',
'title' => 'Yard Maintenance & Clean-Ups',
'description' => 'Yard maintenance done easy and hustle free. Trust us with taking care of your dream home yard.'
],
];
foreach ($data as $i => $item) {
$i++;
$card_settings = "bizbaby_service_card_$i";
$wp_customize->add_setting($card_settings . "title", array(
'default' => $item['title'],
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control($card_settings . "title", array(
'label' => "Service title $i",
'section' => 'bizbaby_settings',
'type' => 'text',
));
$wp_customize->add_setting($card_settings . "link", array(
'type' => 'theme_mod',
'sanitize_callback' => 'esc_url',
));
$wp_customize->add_control($card_settings . "link", array(
'label' => "Service link $i",
'section' => 'bizbaby_settings',
'type' => 'text',
));
$wp_customize->add_setting($card_settings . "description", array(
'default' => $item['description'],
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control($card_settings . "description", array(
'label' => "Service description $i",
'section' => 'bizbaby_settings',
'type' => 'text',
));
$wp_customize->add_setting($card_settings . "image", array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $card_settings . "image", array(
'label' => "Service image $i",
'section' => 'bizbaby_settings',
'settings' => $card_settings . "image",
)));
$wp_customize->add_setting('bizbaby_footer_message_option', array(
'default' => '',
'sanitize_callback' => 'wp_kses_post',
));
$wp_customize->add_control('bizbaby_footer_message_option', array(
'label' => 'Message in footer',
'section' => 'bizbaby_settings',
'type' => 'textarea',
));
}
$wp_customize->add_setting('bizbaby_footer_background_image_setting', array(
'default' => bizbaby_image_url('footer.webp'),
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bizbaby_footer_background_image_setting', array(
'label' => 'Footer image',
'section' => 'bizbaby_settings',
'settings' => 'bizbaby_footer_background_image_setting',
'type' => 'image',
)));
}
add_action('customize_register', 'bizbaby_theme_settings');
function bizbaby_image_url($image)
{
return get_template_directory_uri() . "/img/$image";
}
function set_default_theme_mods()
{
$data = [
[
'image' => bizbaby_image_url('fence.webp'),
'title' => 'Fences & Gates',
'description' => 'A new fence can add a protection to your home and add value to the overall property.'
],
[
'image' => bizbaby_image_url('brick-wall.webp'),
'title' => 'Retaining Walls',
'description' => 'Retaining walls can facelift your home and change the style of your yard and protect it from the weather.'
],
[
'image' => bizbaby_image_url('terrace.webp'),
'title' => 'Patios',
'description' => 'Custom designed and built patio is a must addition to your dream home. Built to accommodate a couple to a party of 10.'
],
[
'image' => bizbaby_image_url('nature.webp'),
'title' => 'Sustainable Landscape Design',
'description' => 'Custom made designs by Seattle Modern Landscapes is the next step towards your dream home.'
],
[
'image' => bizbaby_image_url('garden-sprinkler.webp'),
'title' => 'Irrigation',
'description' => 'Keeping your yard fully supplied during spring to fall months and keeping your irrigation system safe from freezing during the winter months.'
],
[
'image' => bizbaby_image_url('shears.webp'),
'title' => 'Yard Maintenance & Clean-Ups',
'description' => 'Yard maintenance done easy and hustle free. Trust us with taking care of your dream home yard.'
],
];
foreach ($data as $i => $item) {
$i++;
$card_settings = "bizbaby_service_card_$i";
!get_theme_mod($card_settings . "title") && set_theme_mod($card_settings . "title", $item['title']);
!get_theme_mod($card_settings . "description") && set_theme_mod($card_settings . "description", $item['description']);
!get_theme_mod($card_settings . "image") && set_theme_mod($card_settings . "image", $item['image']);
}
!get_theme_mod("bizbaby_slogan_option") && set_theme_mod("bizbaby_slogan_option", "Building Modern Landscapes since 2012");
!get_theme_mod("bizbaby_selected_shortcode") && set_theme_mod("bizbaby_selected_shortcode", '[bizbaby_shortcode type="jobs"]');
!get_theme_mod("bizbaby_selected_footer_shortcode") && set_theme_mod("bizbaby_selected_footer_shortcode", '[bizbaby_shortcode type="service-order"]');
!get_theme_mod("bizbaby_footer_message_option") && set_theme_mod("bizbaby_footer_message_option", "
With over 50 years in landscaping and yard construction. Seattle Modern Landscapes has an experience in any project complexity from simple garden to a protected Shed and Fireplace with water canal types of work.
Please reach out to us with any questions, we will provide a quote within 48 hours or schedule a visit to estimate the work required to make your dream yard come true.");
}
add_action('after_switch_theme', 'set_default_theme_mods');
function bizbaby_custom_page_attributes_metabox() {
add_meta_box(
'custom-attributes-metabox',
'Form in header',
'bizbaby_render_custom_attributes_metabox',
'page',
'normal',
'high'
);
}
add_action('add_meta_boxes', 'bizbaby_custom_page_attributes_metabox');
function bizbaby_save_custom_attributes_data($post_id) {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if (isset($_POST['header_form_attribute'])) {
update_post_meta($post_id, 'header_form_attribute', esc_url($_POST['header_form_attribute']));
}
if (isset($_POST['header_form_attribute'])) {
update_post_meta($post_id, 'service_description', sanitize_text_field($_POST['service_description']));
}
}
add_action('save_post', 'bizbaby_save_custom_attributes_data');
function bizbaby_render_custom_attributes_metabox($post) {
$custom_attribute = get_post_meta($post->ID, 'header_form_attribute', true);
$service_description = get_post_meta($post->ID, 'service_description', true);
?>
';
echo '';
}
add_action('wp_head', 'custom_favicon');*/
/**
* Enqueue scripts and styles.
*/
function bizbaby_scripts()
{
wp_enqueue_style('bizbaby-style', get_stylesheet_uri(), array(), BIZBABY_VERSION);
wp_style_add_data('bizbaby-style', 'rtl', 'replace');
wp_enqueue_script('bizbaby-navigation', get_template_directory_uri() . '/js/navigation.js', array(), BIZBABY_VERSION, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('bizbaby-modal', get_template_directory_uri() . '/js/modals.js', array(), BIZBABY_VERSION, true);
wp_enqueue_script('responsive-forms', get_template_directory_uri() . '/js/responsive_forms.js', array(), BIZBABY_VERSION, true);
}
add_action('wp_enqueue_scripts', 'bizbaby_scripts');
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if (defined('JETPACK__VERSION')) {
require get_template_directory() . '/inc/jetpack.php';
}
add_filter('https_ssl_verify', '__return_false');
/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function bizbaby_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>
" . esc_html__('Bizbaby Free Themes', '') . "";
}