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' => '
{$n}";
}
/**
* Ends the list of after the elements are added.
*
* @since 3.0.0
*
* @see Walker::end_lvl()
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_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 .= "$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.'
` 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 '