esc_html__('Right Sidebar', 'athena'),
'id' => 'sidebar-right',
'description' => '',
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Left Sidebar', 'athena'),
'id' => 'sidebar-left',
'description' => '',
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Shop Sidebar ( WooCommerce )', 'athena'),
'id' => 'sidebar-shop',
'description' => '',
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Footer', 'athena'),
'id' => 'sidebar-footer',
'description' => '',
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Slider Overlay', 'athena'),
'id' => 'sidebar-overlay',
'description' => '',
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Homepage', 'athena'),
'id' => 'sidebar-homepage',
'description' => '',
'before_widget' => '',
'before_title' => '',
));
}
add_action('widgets_init', 'athena_widgets_init');
function athena_do_left_sidebar( $args ) {
if( get_theme_mod( 'sidebar_location', 'right' ) == 'none' ) :
return;
endif;
if( $args[0] == 'frontpage' && get_theme_mod('home_sidebar') == 'off' )
return;
if( $args[0] == 'page' && get_theme_mod('page_sidebar') == 'off' )
return;
if( $args[0] == 'single' && get_theme_mod('single_sidebar') == 'off' )
return;
if( get_theme_mod( 'sidebar_location', 'right' ) == 'left' ) :
echo '';
endif;
}
add_action('athena-sidebar-left', 'athena_do_left_sidebar');
function athena_do_right_sidebar( $args ) {
if( get_theme_mod( 'sidebar_location', 'right' ) == 'none' ) :
return;
endif;
if( $args[0] == 'frontpage' && get_theme_mod('home_sidebar') == 'off' )
return;
if( $args[0] == 'page' && get_theme_mod('page_sidebar') == 'off' )
return;
if( $args[0] == 'single' && get_theme_mod('single_sidebar') == 'off' )
return;
if( get_theme_mod( 'sidebar_location', 'right' ) == 'right' ) :
echo '';
endif;
}
add_action('athena-sidebar-right', 'athena_do_right_sidebar');
function athena_main_width(){
$width = 12;
if( is_active_sidebar('sidebar-left') && is_active_sidebar('sidebar-right') ) :
$width = 6;
elseif( is_active_sidebar('sidebar-left') || is_active_sidebar('sidebar-right') ) :
$width = 9;
else:
$width = 12;
endif;
return $width;
}
function athena_get_image() {
echo wp_get_attachment_url($POST['id']);
exit();
}
add_action('wp_ajax_athena_get_image', 'athena_get_image');
function athena_customize_nav($items) {
$items .= '';
if( class_exists( 'WooCommerce' ) ) :
$items .= ' ' . WC()->cart->get_cart_total() . ' ';
endif;
return $items;
}
add_filter('wp_nav_menu_items', 'athena_customize_nav');
function athena_custom_css() {
?>
'footer',
'menu_id' => 'footer-menu',
'menu_class' => 'athena-footer-nav' ,
) ); ?>
__('Use this widget to display the Athena Recent Posts.', 'athena'),)
);
}
// Creating widget front-end
// This is where the action happens
public function widget($args, $instance) {
if( isset( $instance['title'] ) ) :
$title = apply_filters('widget_title', $instance['title'] );
else :
$title = '';
endif;
// before and after widget arguments are defined by themes
echo $args['before_widget'];
if (!empty($title))
echo $args['before_title'] . $title . $args['after_title'];
echo athena_recent_posts();
}
// Widget Backend
public function form($instance) {
if (isset($instance['title'])) {
$title = $instance['title'];
} else {
$title = __('Recent Articles', 'athena');
}
// Widget admin form
?>
'6',
'post_status' => 'publish',
);
?>