tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); add_theme_support( 'post-formats' , array( 'aside', 'gallery' , 'standard', 'link', 'image' , 'quote', 'status', 'video', 'audio' , 'chat' )); /* * 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( 'menu-1' => esc_html__( 'Primary', 'bizberg' ), 'footer' => esc_html__( 'Footer', 'bizberg' ), ) ); /* * 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', ) ); // 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' => 50, 'width' => 172, 'flex-width' => true, 'flex-height' => true, ) ); add_image_size( 'bizberg_medium', 300, 300, true ); add_image_size( 'bizberg_gallery', 500, 400, true ); add_image_size( 'bizberg_blog_list', 368, 240, true ); add_image_size( 'bizberg_detail_image', 825, 400, true ); add_image_size( 'bizberg_portfolio_homepage', 600, 400, true ); add_image_size( 'bizberg_blog_list_no_sidebar_1', 220, 190, true ); } endif; add_action( 'after_setup_theme', 'bizberg_setup' ); add_filter( 'elegant_blocks_bootstrap', 'bizberg_bootstrap' ); function bizberg_bootstrap(){ return true; } add_filter( 'elegant_blocks_fontawesome', 'bizberg_fontawesome' ); function bizberg_fontawesome(){ return true; } /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function bizberg_content_width() { $GLOBALS['content_width'] = apply_filters( 'bizberg_content_width', 640 ); } add_action( 'after_setup_theme', 'bizberg_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function bizberg_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'bizberg' ), 'id' => 'sidebar-2', 'description' => esc_html__( 'Add widgets here.', 'bizberg' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'bizberg_widgets_init' ); /** * Enqueue scripts and styles backend. */ add_action( 'admin_enqueue_scripts', 'bizberg_custom_wp_admin_style' ); function bizberg_custom_wp_admin_style() { wp_enqueue_style( 'font-awesome-5', get_template_directory_uri() . '/assets/icons/font-awesome-5/css/all.css' ); } /** * Enqueue scripts and styles. */ function bizberg_scripts() { wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap.min.css' ); wp_enqueue_style( 'font-awesome-5', get_template_directory_uri() . '/assets/icons/font-awesome-5/css/all.css' ); wp_enqueue_style( 'bizberg-main', get_template_directory_uri() . '/assets/css/main.css' ); wp_enqueue_style( 'bizberg-component', get_template_directory_uri() . '/assets/css/component.css' ); wp_enqueue_style( 'bizberg-style2', get_template_directory_uri() . '/assets/css/style.css' , array() , '0.8' ); wp_enqueue_style( 'bizberg-responsive', get_template_directory_uri() . '/assets/css/responsive.css' ); wp_enqueue_style( 'bizberg-style', get_stylesheet_uri() ); $scripts = array( array( 'id' => 'bootstrap', 'url' => get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', 'footer' => false ), array( 'id' => 'mousescroll', 'url' => get_template_directory_uri() . '/assets/js/jquery.mousewheel.min.js', 'footer' => true ), array( 'id' => 'smoothscroll', 'url' => get_template_directory_uri() . '/assets/js/smoothscroll.js', 'footer' => true ), array( 'id' => 'inview', 'url' => get_template_directory_uri() . '/assets/js/jquery.inview.min.js', 'footer' => true ), array( 'id' => 'isotope', 'url' => get_template_directory_uri() . '/assets/js/jquery.isotope.min.js', 'footer' => true ), array( 'id' => 'slicknav', 'url' => get_template_directory_uri() . '/assets/js/jquery.slicknav.min.js', 'footer' => true ), array( 'id' => 'matchHeight', 'url' => get_template_directory_uri() . '/assets/js/jquery.matchHeight-min.js', 'footer' => true ), array( 'id' => 'custom', 'url' => get_template_directory_uri() . '/assets/js/custom.js', 'footer' => true ) ); bizberg_add_scripts( $scripts ); wp_add_inline_style( 'bizberg-style', bizberg_inline_style() ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'bizberg_scripts' ); function bizberg_inline_style(){ $detail_page_img_position = get_theme_mod( 'detail_page_img_position' , 'left' ); $inline_css = ''; if( $detail_page_img_position == 'center' ){ $inline_css .= " .detail-content.single_page img { display: block; margin-left: auto; margin-right: auto; text-align: center; }"; } return apply_filters( 'bizberg_inline_style', $inline_css ); } function bizberg_add_scripts( $scripts ){ foreach ( $scripts as $key => $value ) { wp_enqueue_script( $value['id'] , $value['url'] , array('jquery'), 0.8, $value['footer'] ); } } /** * 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'; } /** * WP Comment Walker */ require get_template_directory() . '/wp-comment-walker.php'; /** * Walker Nav Menu */ require get_template_directory() . '/wp-menu-walker.php'; require get_template_directory() . '/inc/class-tgm-plugin-activation.php'; require get_template_directory() . '/inc/fontawesome-5-icons.php'; require get_template_directory() . '/inc/plugins/kirki/kirki.php'; /** * Displays the author name */ function bizberg_get_display_name( $post ){ $user_id = $post->post_author; if( empty( $user_id ) ){ return; } $user_info = get_userdata( $user_id ); echo esc_html( $user_info->display_name ); } function bizberg_post_categories( $post , $limit = false , $plain_text = false , $echo = true ){ $post_categories = wp_get_post_categories( $post->ID ); $cats = array(); foreach($post_categories as $key => $c){ if( $key === $limit ){ break; } $cat = get_category( $c ); if( $plain_text == true ){ $cats[] = esc_html( $cat->name ); } else { $cats[] = '' . esc_html( $cat->name ) . ''; } } if( empty( $cats ) ){ return false; } else{ if( $echo == true ){ echo wp_kses_post( implode( ' , ' , $cats ) ); } else{ return implode( ' , ' , $cats ); } } } function bizberg_numbered_pagination(){ echo '
'; the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => esc_html__( '«', 'bizberg' ), 'next_text' => esc_html__( '»', 'bizberg' ), ) ); echo '
'; } if( !function_exists( 'bizberg_get_custom_logo_link' ) ){ function bizberg_get_custom_logo_link(){ $custom_logo_id = get_theme_mod( 'custom_logo' ); $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' ); if ( has_custom_logo() ) { return $logo[0]; } return; } } function bizberg_get_slider_1(){ $args = array( 'post_type' => 'post', 'posts_per_page' => -1, 'post_status' => 'publish', 'cat' => get_theme_mod( 'slider_category' , '0' ) ); $query = new WP_Query( $args ); $count = 0; if( $query->have_posts() ): ?> $post_type, 'posts_per_page' => -1, 'post_status' => 'publish', 'orderby' => 'name', 'order' => 'ASC' ); $query = new WP_Query($args); $data = array(); if( $query->have_posts() ): while( $query->have_posts() ): $query->the_post(); global $post; $data[$post->ID] = esc_html( get_the_title() ); endwhile; wp_reset_postdata(); endif; return $data; } function bizberg_get_post_categories(){ $terms = get_terms( array( 'taxonomy' => 'category', 'hide_empty' => false, ) ); if( empty($terms) || !is_array( $terms ) ){ return array(); } $data = array(); foreach ( $terms as $key => $value) { $term_id = absint( $value->term_id ); $data[$term_id] = esc_html( $value->name ); } return $data; } function bizberg_sidebar_position(){ $position = get_theme_mod( 'sidebar_settings' , apply_filters( 'bizberg_sidebar_settings', '1' ) ); switch ( $position ) { case 1: return 'blog-rightsidebar'; break; case 2: return 'blog-leftsidebar'; break; case 3: return 'blog-nosidebar'; break; default: return 'blog-nosidebar-1'; break; } } function bizberg_excerpt_length( $length ) { $excerpt_length = get_theme_mod( 'excerpt_length' , 60 ); return $excerpt_length; } add_filter( 'excerpt_length', 'bizberg_excerpt_length', 999 ); function bizberg_icon( $post_id ){ $format = get_post_format( $post_id ); $custom_icon = get_post_meta( $post_id, 'listing_icon', true ); if( !empty( $custom_icon ) ){ return $custom_icon; } switch ( $format ) { case 'aside': return 'fas fa-file-alt'; break; case 'gallery': return 'fas fa-images'; break; case 'link': return 'fas fa-link'; break; case 'image': return 'fas fa-camera-retro'; break; case 'quote': return 'fas fa-quote-right'; break; case 'status': return 'fas fa-thermometer-three-quarters'; break; case 'video': return 'fas fa-video'; break; case 'audio': return 'fas fa-volume-up'; break; case 'chat': return 'fas fa-comments'; break; default: return 'fas fa-thumbtack'; break; } } add_filter( 'get_search_form', 'bizberg_search_form', 100 ); function bizberg_search_form( $form ) { $form = ''; return $form; } function bizberg_get_banner(){ $breadcrumb_bg = get_theme_mod( 'banner_image' ); if( empty( $breadcrumb_bg ) ){ $breadcrumb_bg = get_template_directory_uri() . '/assets/images/breadcrum.jpg'; } ?> ' . esc_html( $home_title ) . ''; if ( is_single() ) { // Get post category info $category = get_the_category(); if(!empty($category)) { // Get last category post is in $last_category = array_slice($category, -1); $last_category = array_pop( $last_category ); // Get parent any categories and create array $get_cat_parents = rtrim(get_category_parents($last_category->term_id, true, ','),','); $cat_parents = explode(',',$get_cat_parents); // Loop through parent categories and store in variable $cat_display $cat_display = ''; foreach($cat_parents as $parents) { $cat_display .= '
  • '. wp_kses_post( $parents ) .'
  • '; } } // If it's a custom post type within a custom taxonomy $taxonomy_exists = taxonomy_exists($custom_taxonomy); if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) { $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy ); if( !empty( $taxonomy_terms ) && is_array( $taxonomy_terms ) ){ $cat_id = $taxonomy_terms[0]->term_id; $cat_nicename = $taxonomy_terms[0]->slug; $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy); $cat_name = $taxonomy_terms[0]->name; } } // Check if the post is in a category if(!empty($last_category)) { $allowed_html = array( 'li' => array( 'class' => array() ), 'a' => array( 'href' => array() ) ); echo wp_kses( $cat_display , $allowed_html ); echo '
  • ' . esc_html( get_the_title() ) . '
  • '; // Else if post is in a custom taxonomy } else if(!empty($cat_id)) { echo '
  • ' . esc_html( $cat_name ) . '
  • '; echo '
  • ' . esc_html( get_the_title() ) . '
  • '; } else { echo '
  • ' . esc_html( get_the_title() ) . '
  • '; } } elseif ( is_category() ) { // Category page echo '
  • ' . single_cat_title('', false) . '
  • '; } elseif ( is_page() ) { // Standard page if( $post->post_parent ){ // If child page, get parents $anc = get_post_ancestors( $post->ID ); $parents = ''; // Get parents in the right order $anc = array_reverse($anc); // Parent page loop foreach ( $anc as $ancestor ) { $parents .= '
  • ' . esc_html( get_the_title($ancestor) ) . '
  • '; } // Display parent pages echo wp_kses( $parents, array( 'li' => array( 'class' => array() ), 'a' => array( 'class' => array(), 'href' => array(), 'title' => array() ), ) ); // Current page echo '
  • ' . esc_html( get_the_title() ) . '
  • '; } else { // Just display current page if not parents echo '
  • ' . esc_html( get_the_title() ) . '
  • '; } } elseif ( is_tag() ) { // Tag page // Get tag information $term_id = get_query_var('tag_id'); $taxonomy = 'post_tag'; $args = 'include=' . $term_id; $terms = get_terms( $taxonomy, $args ); $get_term_id = $terms[0]->term_id; $get_term_slug = $terms[0]->slug; $get_term_name = $terms[0]->name; // Display the tag name echo '
  • ' . esc_html( $get_term_name ) . '
  • '; } elseif ( is_day() ) { // Day archive // Year link echo '
  • ' . esc_html( get_the_time('Y') ) . '
  • '; // Month link echo '
  • ' . esc_html( get_the_time('M') ) . '
  • '; // Day display echo '
  • ' . esc_html( get_the_time('jS') ) . ' ' . esc_html( get_the_time('M') ) . '
  • '; } elseif ( is_month() ) { // Month Archive // Year link echo '
  • ' . esc_html( get_the_time('Y') ) . '
  • '; // Month display echo '
  • ' . esc_html( get_the_time('M') ) . '
  • '; } elseif ( is_year() ) { // Display year archive echo '
  • ' . esc_html( get_the_time('Y') ) . '
  • '; } elseif ( is_author() ) { // Auhor archive // Get the author information global $author; $userdata = get_userdata( $author ); /* translators: %s is replaced with "string". It will display the author name */ echo '
  • ' . sprintf( esc_html__( 'Author: %s', 'bizberg' ) , esc_html( $userdata->display_name ) ) . '
  • '; } elseif ( is_search() ) { $search_title = explode( ',' , get_search_query() ); /* translators: %s is replaced with "string". It will display the search title */ echo '
  • ' . sprintf( esc_html__( 'Search results for: %s' , 'bizberg' ) , esc_html( $search_title[0] ) ) . '
  • '; } elseif ( is_404() ) { // 404 page echo '
  • ' . esc_html__( 'Error 404' , 'bizberg' ) . '
  • '; } elseif( is_tax() ){ $term = get_term_by("slug", get_query_var("term"), get_query_var("taxonomy") ); $tmpTerm = $term; $tmpCrumbs = array(); while ($tmpTerm->parent > 0){ $tmpTerm = get_term($tmpTerm->parent, get_query_var("taxonomy")); $crumb = '
  • ' . esc_html( $tmpTerm->name ) . '
  • '; array_push($tmpCrumbs, $crumb); } echo implode('', array_reverse($tmpCrumbs)); echo '
  • ' . esc_html( $term->name ) . '
  • '; } } } if( !function_exists( 'bizberg_get_copyright_section' ) ){ function bizberg_get_copyright_section(){ esc_html_e( 'Copyright ©', 'bizberg' ); echo date_i18n( __( 'Y' , 'bizberg' ) ); ?> WordPress' ); ?> & ID ); echo ' '; echo absint( $no_of_comments ); echo ''; } add_action( 'admin_notices', 'bizberg_admin_notice_demo_data' ); function bizberg_admin_notice_demo_data() { // Hide bizberg admin message if( !empty( $_GET['status'] ) && $_GET['status'] == 'bizberg_hide_msg' ){ update_option( 'bizberg_hide_msg', true ); } $status = get_option( 'bizberg_hide_msg' ); if( $status == true ){ return; } $check_elegant_block_plugin_status = is_plugin_active( 'elegant-blocks/plugin.php' ) ? true : false; $my_theme = wp_get_theme(); $theme_name = $my_theme->get( 'Name' ); ?>
    '; printf( esc_html__( 'Thank you for installing %1$s', 'bizberg' ), $theme_name ); echo ''; echo '

    ' . esc_html__( "It comes with prebuild templates so that you don't have to build it from the start. Install all recommended plugins to get started." , 'bizberg' ) . '

    '; ?>
    esc_html__( 'One Click Demo Import', 'bizberg' ), 'slug' => 'one-click-demo-import', 'required'=> false, ), array( 'name' => esc_html__( 'Elegant Blocks – Amazing Gutenberg Blocks', 'bizberg' ), 'slug' => 'elegant-blocks', 'required'=> false, ), array( 'name' => esc_html__( 'Gutenberg Blocks – Ultimate Addons for Gutenberg', 'bizberg' ), 'slug' => 'ultimate-addons-for-gutenberg', 'required'=> false, ), array( 'name' => esc_html__( 'Contact Form 7', 'bizberg' ), 'slug' => 'contact-form-7', 'required'=> false, ), array( 'name' => esc_html__( 'Gutenberg', 'bizberg' ), 'slug' => 'gutenberg', 'required'=> false, ), ); $plugins = apply_filters( 'bizberg_recommended_plugins', $plugins ); $config = array( 'id' => 'bizberg_tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'parent_slug' => 'themes.php', // Parent menu slug. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => true, // Automatically activate plugins after installation or not. 'message' => '' // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } function bizberg_get_homepage_style_class(){ if( is_page_template( 'page-templates/page-fullwidth-transparent-header.php' ) ){ return 'page-fullwidth-transparent-header theme-sticky'; } elseif( is_page_template( 'page-templates/page-fullwidth-transparent-header-border.php' ) ){ return 'page-fullwidth-transparent-header-border'; } elseif( is_page_template( 'page-templates/full-width.php' ) ){ return 'page-fullwidth'; } } add_filter('wp_nav_menu_items', 'bizberg_add_items_on_menus', 10, 2); function bizberg_add_items_on_menus( $items, $args ) { if( $args->theme_location == 'menu-1' ){ $search_status = get_theme_mod( 'header_search', false ); $header_button = get_theme_mod( 'header_button', true ); ob_start(); /** * @param boolean $search_status * If true show the search icon */ if( empty( $search_status ) ){ ?> '; $count = 0.2; foreach( $social_icons as $value ){ echo '
  • '; $count = $count + 0.2; } echo ''; } } function bizberg_get_footer_5(){ ?>