get('Version'), true);
wp_enqueue_style('biz-growth-hub-lite-customizer-section-pro', get_template_directory_uri() . '/inc/customizer/customize-controls.css', $theme->get('Version'));
}
add_action('customize_controls_enqueue_scripts', 'biz_growth_hub_lite_customize_controls_js');
function biz_growth_hub_lite_enqueue_comments_reply() {
if (get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('comment_form_before', 'biz_growth_hub_lite_enqueue_comments_reply');
if (!function_exists('biz_growth_hub_lite_sanitize_page')) :
function biz_growth_hub_lite_sanitize_page($page_id, $setting) {
// Ensure $input is an absolute integer.
$page_ids = absint($page_id);
// If $page_id is an ID of a published page, return it; otherwise, return the default.
return ( 'publish' === get_post_status($page_ids) ? $page_ids : $setting->default );
}
endif;
//widet registartion
function biz_growth_hub_lite_widgets_init() {
register_sidebar(array(
'name' => esc_html__('Sidebar', 'biz-growth-hub-lite'),
'description' => esc_html__('Appears on sidebar', 'biz-growth-hub-lite'),
'id' => 'sidebar-1',
'before_widget' => '",
'before_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Column 1', 'biz-growth-hub-lite'),
'description' => esc_html__('Footer first column widget area', 'biz-growth-hub-lite'),
'id' => 'footer-1',
'before_widget' => '",
'before_title' => ''
));
register_sidebar(array(
'name' => esc_html__('Footer Column 2', 'biz-growth-hub-lite'),
'description' => esc_html__('Footer second column widget area', 'biz-growth-hub-lite'),
'id' => 'footer-2',
'before_widget' => '",
'before_title' => ''
));
register_sidebar(array(
'name' => esc_html__('Footer Column 3', 'biz-growth-hub-lite'),
'description' => esc_html__('Footer third column widget area', 'biz-growth-hub-lite'),
'id' => 'footer-3',
'before_widget' => '",
'before_title' => ''
));
register_sidebar(array(
'name' => esc_html__('Footer Column 4', 'biz-growth-hub-lite'),
'description' => esc_html__('Footer fourth column widget area', 'biz-growth-hub-lite'),
'id' => 'footer-4',
'before_widget' => '",
'before_title' => ''
));
}
add_action('widgets_init', 'biz_growth_hub_lite_widgets_init');
// after theme setup hook
if (!function_exists('biz_growth_hub_lite_setup')) :
function biz_growth_hub_lite_setup() {
load_theme_textdomain( 'biz-growth-hub-lite', get_template_directory() . '/languages' );
add_theme_support('automatic-feed-links');
add_theme_support('woocommerce');
add_theme_support('post-thumbnails');
add_theme_support('title-tag');
add_theme_support('custom-logo', array(
'height' => 70,
'width' => 385,
'flex-height' => true,
'flex-width' => true,
));
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'biz-growth-hub-lite'),
'footer' => esc_html__('Footer Menu', 'biz-growth-hub-lite'),
));
add_theme_support('custom-background', array(
'default-color' => 'ffffff'
));
$defaults = array(
'default-image' => get_template_directory_uri() . '/assets/images/slider1.jpg',
'default-text-color' => 'ffffff',
'width' => 1400,
'height' => 500,
'uploads' => true,
'wp-head-callback' => 'biz_growth_hub_lite_header_style',
);
add_theme_support('custom-header', $defaults);
/**
* Add post-formats support.
*/
add_theme_support(
'post-formats',
array(
'link',
'aside',
'gallery',
'image',
'quote',
'status',
'video',
'audio',
'chat',
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
'navigation-widgets',
)
);
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
// Add support for Block Styles.
add_theme_support('wp-block-styles');
// Add support for full and wide align images.
add_theme_support('align-wide');
// Add support for responsive embedded content.
add_theme_support('responsive-embeds');
// Add support for custom line height controls.
add_theme_support('custom-line-height');
// Add support for experimental link color control.
add_theme_support('experimental-link-color');
// Add support for experimental cover block spacing.
add_theme_support('custom-spacing');
// Add support for custom units.
// This was removed in WordPress 5.6 but is still required to properly support WP 5.5.
add_theme_support('custom-units');
// Add editor styles for better user experience
add_editor_style('assets/css/editor-style.css');
add_theme_support('jetpack-content-options', array(
'blog-display' => 'content', // the default setting of the theme: 'content', 'excerpt' or array( 'content', 'excerpt' ) for themes mixing both display.
'author-bio' => true, // display or not the author bio: true or false.
'author-bio-default' => false, // the default setting of the author bio, if it's being displayed or not: true or false (only required if false).
'masonry' => '.site-main', // a CSS selector matching the elements that triggers a masonry refresh if the theme is using a masonry layout.
'post-details' => array(
'stylesheet' => 'biz-growth-hub-lite', // name of the theme's stylesheet.
'date' => '.posted-on', // a CSS selector matching the elements that display the post date.
'categories' => '.cat-links', // a CSS selector matching the elements that display the post categories.
'tags' => '.tags-links', // a CSS selector matching the elements that display the post tags.
'author' => '.byline', // a CSS selector matching the elements that display the post author.
'comment' => '.comments-link', // a CSS selector matching the elements that display the comment link.
),
'featured-images' => array(
'archive' => true, // enable or not the featured image check for archive pages: true or false.
'archive-default' => false, // the default setting of the featured image on archive pages, if it's being displayed or not: true or false (only required if false).
'post' => true, // enable or not the featured image check for single posts: true or false.
'post-default' => false, // the default setting of the featured image on single posts, if it's being displayed or not: true or false (only required if false).
'page' => true, // enable or not the featured image check for single pages: true or false.
'page-default' => false, // the default setting of the featured image on single pages, if it's being displayed or not: true or false (only required if false).
),
));
}
endif; // biz_growth_hub_lite_setup
add_action('after_setup_theme', 'biz_growth_hub_lite_setup');
/**
* Register block styles for block theme transition
*/
function biz_growth_hub_lite_register_block_styles() {
// Register block styles for better block theme compatibility
if (function_exists('register_block_style')) {
// Example: Add a custom style for paragraph blocks
register_block_style(
'core/paragraph',
array(
'name' => 'highlight-box',
'label' => esc_html__('Highlight Box', 'biz-growth-hub-lite'),
'style_handle' => 'biz-growth-hub-lite-style',
)
);
}
}
add_action('after_setup_theme', 'biz_growth_hub_lite_register_block_styles');
/**
* Register block patterns for block theme transition
*/
function biz_growth_hub_lite_register_block_patterns() {
// Register block patterns for better block theme compatibility
if (function_exists('register_block_pattern')) {
register_block_pattern(
'biz-growth-hub-lite/business-hero',
array(
'title' => esc_html__('Business Hero Section', 'biz-growth-hub-lite'),
'description' => esc_html__('A hero section for business websites', 'biz-growth-hub-lite'),
'content' => '' . esc_html__('Hero content goes here', 'biz-growth-hub-lite') . '
',
'categories' => array('featured', 'header'),
)
);
}
}
add_action('after_setup_theme', 'biz_growth_hub_lite_register_block_patterns');
if (!isset($content_width))
$content_width = 900;
//logo header style
function biz_growth_hub_lite_header_style() {
$biz_growth_hub_lite_header_text_color = get_header_textcolor();
if (get_theme_support('custom-header', 'default-text-color') === $biz_growth_hub_lite_header_text_color) {
return;
}
echo '';
}
//define css and js in header part
function biz_growth_hub_lite_style_js() {
$theme = wp_get_theme();
$theme_version = $theme->get('Version');
wp_enqueue_style('bootstrapcss', get_template_directory_uri() . '/vendor/bootstrap/css/bootstrap.css', array(), $theme_version);
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/vendor/css/font-awesome.css', array(), $theme_version);
wp_enqueue_style('biz-growth-hub-lite-basic-style', get_stylesheet_uri(), array(), $theme_version);
wp_enqueue_style('biz-growth-hub-lite-style', get_template_directory_uri() . '/assets/css/main.css', array(), $theme_version);
wp_enqueue_style('biz-growth-hub-lite-responsive', get_template_directory_uri() . '/assets/css/responsive.css', array('biz-growth-hub-lite-style'), $theme_version);
wp_enqueue_script('bootstrapjs', get_template_directory_uri() . '/vendor/bootstrap/js/bootstrap.js', array('jquery'), $theme_version, true);
wp_enqueue_script('biz-growth-hub-lite-toggle-jquery', get_template_directory_uri() . '/assets/js/toggle.js', array('jquery'), $theme_version, true);
}
add_action('wp_enqueue_scripts', 'biz_growth_hub_lite_style_js');
//wp_enqueue_scripts hooks for inline scripts
function biz_growth_hub_lite_skip_link_focus_fix() {
$skip_link_script = '/(trident|msie)/i.test(navigator.userAgent) && document.getElementById && window.addEventListener && window.addEventListener("hashchange", function () {
var t, e = location.hash.substring(1);
/^[A-z0-9_-]+$/.test(e) && (t = document.getElementById(e)) && (/^(?:a|select|input|button|textarea)$/i.test(t.tagName) || (t.tabIndex = -1), t.focus())
}, !1);';
wp_add_inline_script( 'jquery', $skip_link_script );
// Menu dropdown accessibility (keyboard focus adds .hover for submenu visibility)
$accessible_dropdown_script = 'jQuery(document).ready(function () {
jQuery("#main_navigation .nav").bizGrowthHubLiteAccessibleDropDown();
});
jQuery.fn.bizGrowthHubLiteAccessibleDropDown = function () {
var el = jQuery(this);
jQuery("a", el).focus(function () {
jQuery(this).parents("li").addClass("hover");
}).blur(function () {
jQuery(this).parents("li").removeClass("hover");
});
};';
wp_add_inline_script( 'jquery', $accessible_dropdown_script );
}
add_action('wp_enqueue_scripts', 'biz_growth_hub_lite_skip_link_focus_fix');
// Back to top button script
function biz_growth_hub_lite_back_to_top_script() {
$back_to_top_script = 'jQuery(document).ready(function() {
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > 300) {
jQuery("#back-to-top").fadeIn(300);
} else {
jQuery("#back-to-top").fadeOut(300);
}
});
jQuery("#back-to-top").click(function(e) {
e.preventDefault();
jQuery("html, body").animate({scrollTop: 0}, 500);
});
});';
wp_add_inline_script( 'jquery', $back_to_top_script );
}
add_action('wp_enqueue_scripts', 'biz_growth_hub_lite_back_to_top_script');
//content excerpt function
function biz_growth_hub_lite_get_excerpt($postid, $post_count_size) {
$excerpt = get_post_field('post_content', $postid);
if ( empty( $excerpt ) ) {
return '';
}
$excerpt = preg_replace('/ \[.*?\]/', '', $excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, absint($post_count_size));
$last_space = strripos($excerpt, " ");
if ( false !== $last_space ) {
$excerpt = substr($excerpt, 0, $last_space);
}
return $excerpt;
}