__( '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' => false,
'flex-height' => false,
'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',
));
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';
}
/* Display the recommended plugins notice that can be dismissed */
add_action('admin_notices', 'kaira_recommended_plugin_notice');
function kaira_recommended_plugin_notice() {
global $pagenow;
global $current_user;
$user_id = $current_user->ID;
/* If on plugins page, check that the user hasn't already clicked to ignore the message */
if ( $pagenow == 'plugins.php' ) {
if ( ! get_user_meta( $user_id, 'kaira_recommended_plugin_ignore_notice' ) ) {
echo '';
printf( __('
Install the plugins we at Kaira recommended | Hide Notice
'), '?kaira_recommended_plugin_nag_ignore=0' ); ?>
";
}
}
}
add_action('admin_init', 'kaira_recommended_plugin_nag_ignore');
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 );
}
}