__( 'Main Menu', 'albar' )
) );
add_theme_support('post-thumbnails');
if ( function_exists( 'add_image_size' ) ) {
add_image_size('blog_standard_img', 580, 380, true );
}
// The custom header is used for the logo
add_theme_support('custom-header', array(
'default-image' => '',
'width' => 290,
'height' => 110,
'flex-width' => true,
'flex-height' => true,
'header-text' => false,
));
add_editor_style();
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
add_theme_support( 'custom-background', array( 'default-color' => '#ffffff', ) );
add_theme_support( 'title-tag' );
add_theme_support( 'woocommerce' );
}
endif; // kaira_setup
add_action( 'after_setup_theme', 'kaira_setup_theme' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function kaira_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'albar' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
'
) );
register_sidebar(array(
'name' => __('Alba Footer', 'albar'),
'id' => 'site-footer',
'before_widget' => '',
'before_title' => ''
));
register_widget( 'alba_carousel' );
register_widget( 'alba_heading' );
register_widget( 'alba_icon' );
}
add_action( 'widgets_init', 'kaira_widgets_init' );
if(!function_exists('kaira_footer_widget_params')):
/**
* Set the widths of the footer widgets
*
* @param $params
* @return mixed
*
* @filter dynamic_sidebar_params
*/
function kaira_footer_widget_params($params){
// Check that this is the footer
if ($params[0]['id'] != 'site-footer') return $params;
$sidebars_widgets = wp_get_sidebars_widgets();
$count = count($sidebars_widgets[$params[0]['id']]);
$params[0]['before_widget'] = preg_replace('/\>$/', ' style="width:'.round(100/$count,4).'%" >', $params[0]['before_widget']);
return $params;
}
endif;
add_filter('dynamic_sidebar_params', 'kaira_footer_widget_params');
function kaira_print_styles(){
$custom_css = '';
if ( kaira_theme_option( 'kra-custom-css' ) ) {
$custom_css = kaira_theme_option( 'kra-custom-css' );
}
$body_font = kaira_theme_option( 'kra-body-google-font-name' );
$body_font_color = kaira_theme_option( 'kra-body-google-font-color' );
$h_font = kaira_theme_option( 'kra-heading-google-font-name' );
$h_font_color = kaira_theme_option( 'kra-heading-google-font-color' );
$primary_color = kaira_theme_option( 'kra-primary-color' );
$primary_color_hover = kaira_theme_option( 'kra-primary-color-hover' ); ?>
';
}
function kaira_wrap_woocommerce_end() {
echo '';
}
// Create function to check if WooCommerce exists.
if ( ! function_exists( 'kaira_is_woocommerce_activated' ) ) :
function kaira_is_woocommerce_activated() {
if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; }
}
endif; // kaira_is_woocommerce_activated
if ( kaira_is_woocommerce_activated() ) {
require get_template_directory() . '/includes/inc/woocommerce-inc.php';
}
/**
* Exclude slider category from sidebar widgets.
*/
function kaira_exclude_slider_categories_widget( $args ) {
$exclude = ''; // ID's of the categories to exclude
if ( kaira_theme_option( 'kra-slider-categories', false ) ) {
$exclude = kaira_theme_option( 'kra-slider-categories' );
}
$args['exclude'] = $exclude;
return $args;
}
add_filter( 'widget_categories_args', 'kaira_exclude_slider_categories_widget' );
/**
* Display recommended plugins with the TGM class
*/
function kaira_register_required_plugins() {
$plugins = array(
// The recommended WordPress.org plugins.
array(
'name' => 'Elementor',
'slug' => 'elementor',
'required' => false,
),
array(
'name' => 'WooCommerce',
'slug' => 'woocommerce',
'required' => false,
),
array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'required' => false,
),
array(
'name' => 'Breadcrumb NavXT',
'slug' => 'breadcrumb-navxt',
'required' => false,
)
);
$config = array(
'id' => 'albar',
'menu' => 'tgmpa-install-plugins',
'message' => '',
);
tgmpa( $plugins, $config );
}
add_action( 'tgmpa_register', 'kaira_register_required_plugins' );
/**
* Elementor Check
*/
if ( ! defined( 'ELEMENTOR_PARTNER_ID' ) ) {
define( 'ELEMENTOR_PARTNER_ID', 2118 );
}
/* Enque Admin CSS for Conica notice */
function kaira_load_admin_notice_script() {
wp_enqueue_style( 'kaira-admin-notice-css', get_template_directory_uri() . '/settings/css/kaira-admin-notice.css' );
}
add_action( 'admin_enqueue_scripts', 'kaira_load_admin_notice_script' );
/* Display the admin Conica Recommendation notice */
function kaira_recommended_plugin_notice() {
global $current_user;
$user_id = $current_user->ID;
if ( ! get_user_meta( $user_id, 'kaira_recommended_plugin_ignore_notice' ) ) {
echo '';
printf( __( '
', 'albar' ), '?kaira_recommended_plugin_nag_ignore=0' ); ?>
We recommend rather trying out our NEW Power theme, Avant -
Download and try Avant nowWith 7 header layouts, 5 Blog layouts and 3 Footer layouts, full website color options and lots of other customization settings, you\'ll be able to create the perfect site. All built within the WordPress Customizer. If not, Albar will still work and we will keep it updated.
', 'albar' ), admin_url( 'theme-install.php?search=avant' ) ); ?>
';
}
}
add_action('admin_notices', 'kaira_recommended_plugin_notice');
/* Dismiss notice */
function kaira_recommended_plugin_nag_ignore() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset($_GET['kaira_recommended_plugin_nag_ignore']) && '0' == $_GET['kaira_recommended_plugin_nag_ignore'] ) {
add_user_meta( $user_id, 'kaira_recommended_plugin_ignore_notice', 'true', true );
}
}
add_action('admin_init', 'kaira_recommended_plugin_nag_ignore');