get_template_directory_uri() . '/inc/kirki/',
'capability' => 'edit_theme_options',
'option_type' => 'option',
'option_name' => 'awada_theme_options',
'compiler' => array(),
'color_accent' => '#27bebe',
'width' => '23%',
'description' => __('Visit our site for more great Products.If you like this theme please rate us 5 star', 'awada'),
);
return $args;
}
add_filter('kirki/config', 'awada_customizer_config');
require get_template_directory() . '/customizer.php';
add_action('after_setup_theme', 'awada_theme_setup');
$awada_theme_options = awada_theme_options();
function awada_theme_setup()
{
global $content_width;
//content width
if (!isset($content_width)) {
$content_width = 1068;
}
//px
//supports featured image
add_theme_support('post-thumbnails');
load_theme_textdomain('awada', get_template_directory() . '/lang');
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array(
'primary' => __('Primary menu', 'awada'),
'secondary' => __('Footer Menu', 'awada'),
'social' => __('Social Links Menu', 'awada'),
));
// theme support
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
$args = array('default-color' => '#ffffff', 'default-image' => '');
$args1 = array(
'flex-width' => true,
'width' => 1350,
'flex-height' => true,
'height' => 60,
'default-image' => '',
'header-text-color' => 'blue',
'header-text' => true,
'wp-head-callback' => 'awada_header_style',
);
add_editor_style('css/editor-style.css');
add_theme_support('custom-background', $args);
add_theme_support('custom-header', $args1);
add_theme_support('automatic-feed-links');
add_theme_support('woocommerce');
add_theme_support('title-tag');
add_theme_support('custom-logo', array(
'height' => 50,
'width' => 150,
'flex-height' => true,
'flex-width' => true,
));
/*
* 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',
));
// Recommend plugins
add_theme_support('recommend-plugins', array(
'fusion-slider' => array(
'name' => 'Fusion Slider', // The plugin name.
'active_filename' => 'fusion-slider/fusion-slider.php',
),
'photo-video-gallery-master' => array(
'name' => 'Photo Video Gallery Master', // The plugin name.
'active_filename' => 'photo-video-gallery-master/photo-video-gallery-master.php',
),
'ultimate-gallery-master' => array(
'name' => 'Ultimate Gallery Master', // The plugin name.
'active_filename' => 'ultimate-gallery-master/ultimate-gallery-master-lite.php',
),
'social-media-gallery' => array(
'name' => 'Social Media Gallery', // The plugin name.
'active_filename' => 'social-media-gallery/social-media-gallery.php',
),
'coming-soon-master' => array(
'name' => 'Coming Soon Master', // The plugin name.
'active_filename' => 'coming-soon-master/coming-soon-master.php',
),
));
add_theme_support('starter-content', array(
'posts' => array(
'home' => array(
'template' => 'home-page.php',
),
'about' => array(
'thumbnail' => '{{image-sandwich}}',
),
'contact' => array(
'thumbnail' => '{{image-espresso}}',
),
'blog' => array(
'thumbnail' => '{{image-coffee}}',
),
),
'options' => array(
'awada_theme_options[portfolio_home]' => 1,
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
),
'widgets' => array(
'sidebar-widget' => array(
'search',
'text_business_info',
'text_about',
'category',
'tags',
),
'footer-widget' => array(
'text_business_info',
'text_about',
'meta',
'search',
),
),
'nav_menus' => array(
'primary-sidebar' => array(
'name' => __('Primary Menu', 'awada'),
'items' => array(
'page_home',
'page_about',
'page_blog',
'page_contact',
),
),
'secondary-sidebar' => array(
'name' => __('Primary Menu', 'awada'),
'items' => array(
'page_home',
'page_about',
'page_blog',
'page_contact',
),
),
'footer-widget' => array(
'name' => __('Footer Menu', 'awada'),
'items' => array(
'page_home',
'page_about',
'page_blog',
'page_contact',
),
),
'social' => array(
'name' => __('Social Links Menu', 'awada'),
'items' => array(
'link_yelp',
'link_facebook',
'link_twitter',
'link_instagram',
'link_email',
),
),
),
));
add_image_size('awada_home_slider_bg_image', 1600, 500, true);
add_image_size('awada_blog_full_thumb', 1090, 515, true);
add_image_size('awada_blog_sidebar_thumb', 805, 350, true);
add_image_size('awada_blog_two_sidebar_thumb', 520, 260, true);
add_image_size('awada_blog_home_thumb', 330, 206, true);
add_image_size('awada_recent_widget_thumb', 120, 77, true);
}
if (!function_exists('awada_header_style')):
/**
* Styles the header image and text displayed on the blog.
*
* @see awada_custom_header_setup().
*/
function awada_header_style()
{
$header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail.
// get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value.
if (get_theme_support('custom-header', 'default-text-color') === $header_text_color) {
return;
}
// If we get this far, we have custom styles. Let's do this.
?>
' . __('Read More', 'awada') . '';
}
add_filter('the_content_more_link', 'awada_content_more');
// Replaces the excerpt "more" text by a link
function awada_excerpt_more($more)
{
return '' . __('Read More...', 'awada') . '';
}
add_filter('excerpt_more', 'awada_excerpt_more');
/*
* Awada widget area
*/
add_action('widgets_init', 'awada_widget');
function awada_widget()
{
/*sidebar*/
$awada_theme_options = awada_theme_options();
$col = 12 / (int) $awada_theme_options['footer_layout'];
register_sidebar(array(
'name' => __('Primary Sidebar Widget Area', 'awada'),
'id' => 'primary-sidebar',
'description' => __('Right sidebar widget area', 'awada'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Secondary Sidebar Widget Area', 'awada'),
'id' => 'secondary-sidebar',
'description' => __('Left sidebar widget area', 'awada'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Footer Widget Area', 'awada'),
'id' => 'footer-widget',
'description' => __('Footer widget area', 'awada'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
));
}
/* Breadcrumbs */
function awada_breadcrumbs()
{
$delimiter = '';
$home = __('Home', 'awada'); // text for the 'Home' link
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
echo '';
global $post;
$homeLink = home_url();
if (is_front_page()) {
echo '- ' . $home . '';
} else {
echo '
- ' . $home . '' . $delimiter;
}
if (is_category()) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0) {
echo (get_category_parents($parentCat, true, ' ' . $delimiter . '
'));
}
echo $before . _e("Category ", 'awada') . ' ' . single_cat_title($delimiter, false) . '' . $after;
} elseif (is_day()) {
echo '- ' . get_the_time('Y') . '' . $delimiter . '
';
echo '- ' . get_the_time('F') . ' ' . $delimiter;
echo $before . get_the_time('d') . '
';
} elseif (is_month()) {
echo '- ' . get_the_time('Y') . '' . $delimiter;
echo $before . get_the_time('F') . '
';
} elseif (is_year()) {
echo $before . get_the_time('Y') . '';
} elseif (is_single() && !is_attachment()) {
if (get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '- ' . $post_type->labels->singular_name . ' ' . $delimiter;
echo $before . get_the_title() . '
';
} else {
$cat = get_the_category();
$cat = $cat[0];
//echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo $before . get_the_title() . '';
}
} elseif (!is_single() && !is_page() && get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
if ($post_type == null) {
echo $before . __('Nothing Found', 'awada') . $after;
} else {
echo $before . $post_type->labels->singular_name . $after;
}
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
echo get_category_parents($cat, true, ' ' . $delimiter . ' ');
echo '- ' . $parent->post_title . '' . $delimiter;
echo $before . get_the_title() . $after;
} elseif (is_page() && !$post->post_parent) {
echo $before . get_the_title() . $after;
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '
- ' . get_the_title($page->ID) . '
';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo $crumb . ' ' . $delimiter . ' ';
}
echo $before . get_the_title() . $after;
} elseif (is_search()) {
echo $before . _e("Search results for ", 'awada') . get_search_query() . '"' . $after;
} elseif (is_tag()) {
echo $before . _e('Tag ', 'awada') . single_tag_title($delimiter, false) . $after;
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
echo $before . _e("Articles posted by: ", 'awada') . $userdata->display_name . $after;
} elseif (is_404()) {
echo $before . _e("Error 404 ", 'awada') . $after;
} elseif (single_post_title()) {
echo $before . single_post_title() . $after;
}
echo '
';
}
/* Blog Pagination */
if (!function_exists('awada_pagination')) {
function awada_pagination()
{
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'prev_next' => false,
'type' => 'array',
'prev_next' => true,
'prev_text' => '«',
'next_text' => '»',
));
if (is_array($pages)) {
$paged = (get_query_var('paged') == 0) ? 1 : get_query_var('paged');
echo "";
}
}
}
/*** Post pagination ***/
function awada_pagination_link()
{?>
admin_url('admin-ajax.php'),
'ppp' => $awada_theme_options['home_load_post_num'],
'noposts' => $awada_theme_options['blog_no_more_post'],
));
if ($awada_theme_options['show_load_more_btn']) {
wp_enqueue_script('load-posts', get_template_directory_uri() . '/js/load-more.js');
}
if (class_exists('WooCommerce')) {
if (is_shop() || is_cart() || is_product() || is_checkout() || is_product_category()) {
wp_enqueue_script('jquery.dcjqaccordion', get_template_directory_uri() . '/js/jquery.dcjqaccordion.js', array('jquery'));
$dcjq = ' jQuery(".product-categories").dcAccordion({
saveState: false,
autoExpand: true,
showCount: true,
});
jQuery(".dcjq-icon").click(function(){
jQuery(this).toggleClass("less");
});';
wp_add_inline_script('jquery.dcjqaccordion', $dcjq);
}
}
// Support for HTML5
//[if lt IE 9]
wp_enqueue_script('html5-shiv', get_template_directory_uri() . '/js/html5_shiv.js');
wp_script_add_data('html5-shiv', 'conditional', 'lt IE 9');
//[endif]
}
// Comment Function
function awada_comments($comments, $args, $depth)
{
$GLOBALS['comment'] = $comments;
extract($args, EXTR_SKIP);
if ('div' == $args['style']) {
$add_below = 'comment';
} else {
$add_below = 'div-comment';
}
?>
id="comment-">
';
if ($layout == 'leftsidebar') {get_sidebar();}
echo '
';
}
function awada_theme_wrapper_end()
{
$awada_theme_options = awada_theme_options();
$layout = $awada_theme_options['page_layout'];
echo '
';
if ($layout == 'rightsidebar') {get_sidebar();}
;
echo '
';
}
/* Ajax Load Moe posts */
add_action('wp_ajax_nopriv_awada_more_post_ajax', 'awada_more_post_ajax');
add_action('wp_ajax_awada_more_post_ajax', 'awada_more_post_ajax');
if (!function_exists('awada_more_post_ajax')) {
function awada_more_post_ajax()
{
$awada_theme_options = awada_theme_options();
$ppp = (isset($_POST['ppp'])) ? $_POST['ppp'] : 3;
$offset = (isset($_POST['offset'])) ? $_POST['offset'] : 0;
$port_id = ($awada_theme_options['portfolio_post'] == ''?'':$awada_theme_options['portfolio_post']);
$portfolio_id = intval($port_id);
$args = array(
'post_type' => 'post',
'posts_per_page' => $ppp,
'offset' => $offset,
'post__not_in' => array($portfolio_id)
);
if (isset($awada_theme_options['home_post_cat']) && !empty($awada_theme_options['home_post_cat'])) {
$args['category__in'] = $awada_theme_options['home_post_cat'];
}
$loop = new WP_Query($args);
$out = '';
$i = 1;
if ($loop->have_posts()):
while ($loop->have_posts()):
$loop->the_post();
$out .= '
';
$img_class = array('class' => 'img-responsive full-width');
if (has_post_thumbnail()) {
$url = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
$out .= get_the_post_thumbnail(get_the_ID(),'awada_blog_home_thumb', $img_class);
$out .= '
';
}
$out .= '
'.get_the_excerpt().'
';
endwhile;
endif;
wp_reset_postdata();
wp_die($out);
}
}
?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])));?>
comment_approved == '0') {?>