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( 'menu-1' => esc_html__('Primary', 'bussiness-bootstrap-by-ifour-technolab'), )); /* * 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', )); // Set up the WordPress core custom background feature. add_theme_support('custom-background', apply_filters('bussiness_bootstrap_theme_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ))); // Add theme support for selective refresh for widgets. add_theme_support('customize-selective-refresh-widgets'); } endif; add_action('after_setup_theme', 'bussiness_bootstrap_theme_setup'); /** * 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 bussiness_bootstrap_theme_content_width() { $GLOBALS['content_width'] = apply_filters('bussiness_bootstrap_theme_content_width', 640); } add_action('after_setup_theme', 'bussiness_bootstrap_theme_content_width', 0); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function bussiness_bootstrap_theme_widgets_init() { register_sidebar(array( 'name' => esc_html__('Sidebar', 'bussiness-bootstrap-by-ifour-technolab'), 'id' => 'sidebar-1', 'description' => esc_html__('Add widgets here.', 'bussiness-bootstrap-by-ifour-technolab'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Footer Left', 'bussiness-bootstrap-by-ifour-technolab'), 'id' => 'footer-1', 'description' => esc_html__('Add widgets here.', 'bussiness-bootstrap-by-ifour-technolab'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Footer Center', 'bussiness-bootstrap-by-ifour-technolab'), 'id' => 'footer-2', 'description' => esc_html__('Add widgets here.', 'bussiness-bootstrap-by-ifour-technolab'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Footer Right', 'bussiness-bootstrap-by-ifour-technolab'), 'id' => 'footer-3', 'description' => esc_html__('Add widgets here.', 'bussiness-bootstrap-by-ifour-technolab'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'bussiness_bootstrap_theme_widgets_init'); /** * Enqueue scripts and styles. */ function bussiness_bootstrap_theme_scripts() { /* Bootstrap */ wp_enqueue_style('bussiness-bootstrap-style', get_template_directory_uri().'/css/bootstrap.min.css', array(), 'alpha-6', 'all'); wp_enqueue_script('bussiness-bootstrap-tether-script', get_template_directory_uri().'/js/tether.min.js', array('jquery'), 'alpha-6', true); wp_enqueue_script('bussiness-bootstrap-script', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery', 'bussiness-bootstrap-tether-script'), 'alpha-6', true); wp_enqueue_script('bussiness-bootstrap-holder-script', get_template_directory_uri().'/js/vendor/holder.min.js', array('jquery'), 'alpha-6', true); /* * Custom fonts. */ /* wp_enqueue_style('bussiness-bootstrap-ubuntu-fonts', "https://fonts.googleapis.com/css?family=Ubuntu:400,400i,500,700", array(), 'alpha-6', 'all'); */ //font-family: 'Ubuntu', sans-serif; /* wp_enqueue_style('bussiness-bootstrap-merriweather-fonts', "https://fonts.googleapis.com/css?family=Merriweather:300,300i,400,400i,700,700i", array(), 'alpha-6', 'all'); */ //font-family: 'Merriweather', serif; wp_enqueue_style('bussiness-bootstrap-raleway-fonts', "https://fonts.googleapis.com/css?family=Raleway:200,300,400,500,600,700", array(), 'alpha-6', 'all'); //font-family: 'Raleway', sans-serif; wp_enqueue_style('bussiness-bootstrap-font-awesome', get_template_directory_uri().'/css/font-awesome.css'); wp_enqueue_style('bussiness-bootstrap-theme-style', get_stylesheet_uri()); wp_enqueue_script('bussiness-bootstrap-theme-js', get_template_directory_uri().'/js/app.js', array('jquery'), 'alpha-6', true); wp_enqueue_script('bussiness-bootstrap-theme-navigation', get_template_directory_uri().'/js/navigation.js', array('jquery'), '20151215', true); wp_localize_script('bussiness-bootstrap-theme-navigation', 'screenReaderText', array( 'expand' => ''.__('expand child menu', 'bussiness-bootstrap-by-ifour-technolab').'', 'collapse' => ''.__('collapse child menu', 'bussiness-bootstrap-by-ifour-technolab').'', )); wp_enqueue_script( 'bussiness-bootstrap-theme-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20151215', true); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'bussiness_bootstrap_theme_scripts'); /** * Include all files. */ require get_template_directory().'/vendor/autoload.php'; /** * WP Bootstrap Navwalker * * @package WP-Bootstrap-Navwalker */ /* * Class Name: WP_Bootstrap_Navwalker * Plugin Name: WP Bootstrap Navwalker * Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker * Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme using the WordPress built in menu manager. * Author: Edward McIntyre - @twittem, WP Bootstrap * Version: 2.0.5 * Author URI: https://github.com/wp-bootstrap * GitHub Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker * License: GPL-3.0+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt */ if (!class_exists('Bb_Walker_Menu')) { /** * */ class Bb_Walker_Menu extends Walker_Nav_Menu { public function start_lvl(&$output, $depth = 0, $args = array()) { if (isset($args->item_spacing) && 'discard' === $args->item_spacing) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat($t, $depth); $output .= "{$n}{$indent}{$n}"; } /** * Starts the element output. * * @since 3.0.0 * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added. * * @see Walker::start_el() * * @param string $output Passed by reference. Used to append additional content. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $id Current item ID. */ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { if (isset($args->item_spacing) && 'discard' === $args->item_spacing) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = ( $depth ) ? str_repeat($t, $depth) : ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-'.$item->ID; /** * Filters the arguments for a single nav menu item. * * @since 4.4.0 * * @param stdClass $args An object of wp_nav_menu() arguments. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. */ $args = apply_filters('nav_menu_item_args', $args, $item, $depth); /** * Filters the CSS class(es) applied to a menu item's list item element. * * @since 3.0.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $classes The CSS classes that are applied to the menu item's `
  • ` element. * @param WP_Post $item The current menu item. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth)); if ($args->walker->has_children) { $class_names .= ' dropdown'; } $class_names = $class_names ? ' class="'.esc_attr($class_names).'"' : ''; /** * Filters the ID applied to a menu item's list item element. * * @since 3.0.1 * @since 4.1.0 The `$depth` parameter was added. * * @param string $menu_id The ID that is applied to the menu item's `
  • ` element. * @param WP_Post $item The current menu item. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $id = apply_filters('nav_menu_item_id', 'menu-item-'.$item->ID, $item, $args, $depth); $id = $id ? ' id="'.esc_attr($id).'"' : ''; $output .= $indent.''; $atts = array(); $atts['title'] = !empty($item->attr_title) ? $item->attr_title : ''; $atts['target'] = !empty($item->target) ? $item->target : ''; $atts['rel'] = !empty($item->xfn) ? $item->xfn : ''; $atts['href'] = !empty($item->url) ? $item->url : ''; /** * Filters the HTML attributes applied to a menu item's anchor element. * * @since 3.6.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $atts { * The HTML attributes applied to the menu item's `` element, empty strings are ignored. * * @type string $title Title attribute. * @type string $target Target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * } * @param WP_Post $item The current menu item. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth); $atts['class'] = (isset($atts['class'])) ? $atts['class'].' ' : ''; $atts['class'] .= 'nav-link'; if (in_array('current-menu-item', $item->classes)) { $atts['class'] .= ' active'; } $attributes = ''; foreach ($atts as $attr => $value) { if (!empty($value)) { $value = ( 'href' === $attr ) ? esc_url($value) : esc_attr($value); $attributes .= ' '.$attr.'="'.$value.'"'; } } /** This filter is documented in wp-includes/post-template.php */ $title = apply_filters('the_title', $item->title, $item->ID); /** * Filters a menu item's title. * * @since 4.4.0 * * @param string $title The menu item's title. * @param WP_Post $item The current menu item. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $title = apply_filters('nav_menu_item_title', $title, $item, $args, $depth); $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before.$title.$args->link_after; $item_output .= ''; $item_output .= $args->after; /** * Filters a menu item's starting output. * * The menu item's starting output only includes `$args->before`, the opening ``, * the menu item's title, the closing ``, and `$args->after`. Currently, there is * no filter for modifying the opening and closing `
  • ` for a menu item. * * @since 3.0.0 * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. */ $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } /** * Ends the element output, if needed. * * @since 3.0.0 * * @see Walker::end_el() * * @param string $output Passed by reference. Used to append additional content. * @param WP_Post $item Page data object. Not used. * @param int $depth Depth of page. Not Used. * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_el(&$output, $item, $depth = 0, $args = array()) { if (isset($args->item_spacing) && 'discard' === $args->item_spacing) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $output .= "
  • {$n}"; } /** * * Fallback function. * If there is no menu item define then this function call. * @param type $args */ public static function fallback($args) { if (current_user_can('edit_theme_options')) { /* Get Arguments. */ $container = $args['container']; $container_id = $args['container_id']; $container_class = $args['container_class']; $menu_class = $args['menu_class']; $menu_id = $args['menu_id']; if ($container) { echo '<'.esc_attr($container); if ($container_id) { echo ' id="'.esc_attr($container_id).'"'; } if ($container_class) { echo ' class="'.esc_attr($container_class).'"'; } echo '>'; } echo ''; echo '
  • '; echo ''; if ($container) { echo ''; } } } } } /* |-------------------------------------------------------------------------- | Widget |-------------------------------------------------------------------------- | */ function wpdocs_my_search_form($form) { $form = ''; return $form; } add_filter('get_search_form', 'wpdocs_my_search_form'); function bb_theme_comment_form_default_fields($fields) { $commenter = wp_get_current_commenter(); $req = get_option('require_name_email'); $aria_req = ( $req ? " aria-required='true'" : '' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = current_theme_supports('html5', 'comment-form'); $fields = [ 'author' => '
    '.' '. '
    ', 'email' => '
    '. '
    ', 'url' => '
    '. '
    ', ]; return $fields; } add_filter('comment_form_default_fields', 'bb_theme_comment_form_default_fields'); /* * Widget Category class for dropdown menu. * https://developer.wordpress.org/reference/hooks/widget_categories_dropdown_args/ */ function bb_theme_filter_widget_categories_dropdown_args($cat_args) { if (isset($cat_args['class'])) { $cat_args['class'] .= ' form-control'; } else { $cat_args['class'] = 'form-control'; } return $cat_args; } add_filter('widget_categories_dropdown_args', 'bb_theme_filter_widget_categories_dropdown_args'); /** * * Widget Category class for List item. * https://developer.wordpress.org/reference/functions/wp_list_categories/ * @param type $output * @param type $args * @return type */ function style_current_cat_single_post($output, $args) { //var_dump($args['class'] = ''); return $output; } add_filter('wp_list_categories', 'style_current_cat_single_post', 10, 2); add_filter('post_thumbnail_html', 'my_post_image_html', 10, 3); function my_post_image_html($html, $post_id, $post_image_id) { $html = ''.$html.''; return $html; } function generate_slider() { global $bbt_theme_options; $args = array( 'post_type' => 'slider', 'posts_per_page' => $bbt_theme_options['sliders_show'], 'meta_query' => array( array( 'key' => 'display_in_homepage', 'value' => '1', 'compare' => '==' ) ) ); $slider = ''; $the_query = new WP_Query($args); if ($the_query->have_posts()) : $i = 1; while ($the_query->have_posts()) : $the_query->the_post(); $image = get_field('slider', get_the_ID()); if (!empty($image)): $url = $image['url']; $caption = $image['caption']; $size = 'medium_large'; $thumb = $image['sizes'][$size]; if ($i == 1) : $slider .= '