'
)
);
}
add_action( 'widgets_init', 'azera_shop_widgets_init' );
/**
* Fallback Menu
*
* If the menu doesn't exist, the fallback function to use.
*/
function azera_shop_wp_page_menu()
{
echo '
';
}
/**
* Enqueue scripts and styles.
*/
function azera_shop_scripts() {
wp_enqueue_style( 'parallax-one-font', '//fonts.googleapis.com/css?family=Cabin:400,600|Open+Sans:400,300,600');
wp_enqueue_style( 'parallax-one-bootstrap-style', azera_shop_get_file( '/css/bootstrap.min.css'),array(), '3.3.1');
wp_enqueue_style( 'parallax-one-style', get_stylesheet_uri(), array('parallax-one-bootstrap-style'),'1.0.0');
wp_enqueue_script( 'parallax-one-bootstrap', azera_shop_get_file('/js/bootstrap.min.js'), array(), '3.3.5', true );
wp_enqueue_script( 'parallax-one-custom-all', azera_shop_get_file('/js/custom.all.js'), array('jquery'), '2.0.2', true );
wp_localize_script( 'parallax-one-custom-all', 'screenReaderText', array(
'expand' => '' . esc_html__( 'expand child menu', 'azera-shop' ) . '',
'collapse' => '' . esc_html__( 'collapse child menu', 'azera-shop' ) . '',
) );
$azera_shop_enable_move = get_theme_mod('azera_shop_enable_move');
if ( !empty($azera_shop_enable_move) && $azera_shop_enable_move && is_page_template('template-frontpage.php') ) {
wp_enqueue_script( 'parallax-one-home-plugin', azera_shop_get_file('/js/plugin.home.js'), array('jquery','parallax-one-custom-all'), '1.0.1', true );
}
if ( is_page_template('template-frontpage.php') ) {
wp_enqueue_script( 'parallax-one-custom-home', azera_shop_get_file('/js/custom.home.js'), array('jquery'), '1.0.0', true );
}
wp_enqueue_script( 'parallax-one-skip-link-focus-fix', azera_shop_get_file('/js/skip-link-focus-fix.js'), array(), '1.0.0', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'azera_shop_scripts' );
function azera_shop_add_id(){
$migrate = get_option( 'azera_shop_migrate_translation' );
if( isset($migrate) && $migrate == false ) {
/*Logo*/
$azera_shop_logos = get_theme_mod('azera_shop_logos_content', json_encode(array( array("image_url" => azera_shop_get_file('/images/companies/1.png') ,"link" => "#" ),array("image_url" => azera_shop_get_file('/images/companies/2.png') ,"link" => "#" ),array("image_url" => azera_shop_get_file('/images/companies/3.png') ,"link" => "#" ),array("image_url" => azera_shop_get_file('/images/companies/4.png') ,"link" => "#" ),array("image_url" => azera_shop_get_file('/images/companies/5.png') ,"link" => "#" ) )));
if(!empty($azera_shop_logos)){
$azera_shop_logos_decoded = json_decode($azera_shop_logos);
foreach($azera_shop_logos_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_logos = json_encode($azera_shop_logos_decoded);
set_theme_mod( 'azera_shop_logos_content', $azera_shop_logos );
}
/*Services*/
$azera_shop_services = get_theme_mod('azera_shop_services_content', json_encode(
array(
array('choice'=>'azera_shop_icon','icon_value' => 'icon-basic-webpage-multiple','title' => esc_html__('Lorem Ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.','azera-shop')),
array('choice'=>'azera_shop_icon','icon_value' => 'icon-ecommerce-graph3','title' => esc_html__('Lorem Ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.','azera-shop')),
array('choice'=>'azera_shop_icon','icon_value' => 'icon-basic-geolocalize-05','title' => esc_html__('Lorem Ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.','azera-shop'))
)
));
if(!empty($azera_shop_services)){
$azera_shop_services_decoded = json_decode($azera_shop_services);
foreach($azera_shop_services_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_services = json_encode($azera_shop_services_decoded);
set_theme_mod( 'azera_shop_services_content', $azera_shop_services );
}
/*Team*/
$azera_shop_team = get_theme_mod('azera_shop_team_content', json_encode(
array(
array('image_url' => azera_shop_get_file('/images/team/1.jpg'),'title' => esc_html__('Albert Jacobs','azera-shop'),'subtitle' => esc_html__('Founder & CEO','azera-shop')),
array('image_url' => azera_shop_get_file('/images/team/2.jpg'),'title' => esc_html__('Tonya Garcia','azera-shop'),'subtitle' => esc_html__('Account Manager','azera-shop')),
array('image_url' => azera_shop_get_file('/images/team/3.jpg'),'title' => esc_html__('Linda Guthrie','azera-shop'),'subtitle' => esc_html__('Business Development','azera-shop'))
)
));
if(!empty($azera_shop_team)){
$azera_shop_team_decoded = json_decode($azera_shop_team);
foreach($azera_shop_team_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_team = json_encode($azera_shop_team_decoded);
set_theme_mod( 'azera_shop_team_content', $azera_shop_team );
}
/*Testimonials*/
$azera_shop_testimonials = get_theme_mod('azera_shop_testimonials_content', json_encode(
array(
array('image_url' => azera_shop_get_file('/images/clients/1.jpg'),'title' => esc_html__('Happy Customer','azera-shop'),'subtitle' => esc_html__('Lorem ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.','azera-shop')),
array('image_url' => azera_shop_get_file('/images/clients/2.jpg'),'title' => esc_html__('Happy Customer','azera-shop'),'subtitle' => esc_html__('Lorem ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.','azera-shop')),
array('image_url' => azera_shop_get_file('/images/clients/3.jpg'),'title' => esc_html__('Happy Customer','azera-shop'),'subtitle' => esc_html__('Lorem ipsum','azera-shop'),'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.','azera-shop'))
)
));
if(!empty($azera_shop_testimonials)){
$azera_shop_testimonials_decoded = json_decode($azera_shop_testimonials);
foreach($azera_shop_testimonials_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_testimonials = json_encode($azera_shop_testimonials_decoded);
set_theme_mod( 'azera_shop_testimonials_content', $azera_shop_testimonials );
}
/*Contact Info*/
$azera_shop_contact_info = get_theme_mod('azera_shop_contact_info_content', json_encode(
array(
array("icon_value" => "icon-basic-mail" ,"text" => "contact@site.com", "link" => "#" ),
array("icon_value" => "icon-basic-geolocalize-01" ,"text" => "Company address", "link" => "#" ),
array("icon_value" => "icon-basic-tablet" ,"text" => "0 332 548 954", "link" => "#" )
)
));
if(!empty($azera_shop_contact_info)){
$azera_shop_contact_info_decoded = json_decode($azera_shop_contact_info);
foreach($azera_shop_contact_info_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_contact_info = json_encode($azera_shop_contact_info_decoded);
set_theme_mod( 'azera_shop_contact_info_content', $azera_shop_contact_info );
}
/*Social Icons*/
$azera_shop_social_icons = get_theme_mod('azera_shop_social_icons', json_encode(
array(
array('icon_value' =>'icon-social-facebook' , 'link' => '#'),
array('icon_value' =>'icon-social-twitter' , 'link' => '#'),
array('icon_value' =>'icon-social-googleplus' , 'link' => '#')
)
));
if(!empty($azera_shop_social_icons)){
$azera_shop_social_icons_decoded = json_decode($azera_shop_social_icons);
foreach($azera_shop_social_icons_decoded as &$it){
if(!array_key_exists ( "id" , $it ) || !($it->id) ){
$it = (object) array_merge( (array)$it, array( 'id' => 'azera_shop_'.uniqid() ) );
}
}
$azera_shop_social_icons = json_encode($azera_shop_social_icons_decoded);
set_theme_mod( 'azera_shop_social_icons', $azera_shop_social_icons );
}
update_option( 'azera_shop_migrate_translation', true );
}
}
add_action( 'shutdown', 'azera_shop_add_id' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
function azera_shop_admin_styles() {
wp_enqueue_style( 'parallax_admin_stylesheet', azera_shop_get_file('/css/admin-style.css'),'1.0.0' );
}
add_action( 'admin_enqueue_scripts', 'azera_shop_admin_styles', 10 );
// Adding IE-only scripts to header.
function azera_shop_ie () {
echo '' . "\n";
}
add_action('wp_head', 'azera_shop_ie');
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'azera_shop_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'azera_shop_wrapper_end', 10);
function azera_shop_wrapper_start() {
echo ' ';
echo '
';
}
function azera_shop_wrapper_end() {
echo '
';
}
// add this code directly, no action needed
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
/* tgm-plugin-activation */
require_once get_template_directory() . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'azera_shop_register_required_plugins' );
function azera_shop_register_required_plugins() {
$plugins = array(
array(
'name' => 'Intergeo Maps - Google Maps Plugin',
'slug' => 'intergeo-maps',
'required' => false
),
array(
'name' => 'Pirate Forms',
'slug' => 'pirate-forms',
'required' => false
)
);
$config = array(
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'has_notices' => true,
'dismissable' => true,
'dismiss_msg' => '',
'is_automatic' => false,
'message' => '',
'strings' => array(
'page_title' => esc_html__( 'Install Required Plugins', 'azera-shop' ),
'menu_title' => esc_html__( 'Install Plugins', 'azera-shop' ),
'installing' => esc_html__( 'Installing Plugin: %s', 'azera-shop' ),
'oops' => esc_html__( 'Something went wrong with the plugin API.', 'azera-shop' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'azera-shop' ),
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'azera-shop' ),
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'azera-shop' ),
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'azera-shop' ),
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'azera-shop' ),
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'azera-shop' ),
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'azera-shop' ),
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'azera-shop' ),
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'azera-shop' ),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'azera-shop' ),
'return' => esc_html__( 'Return to Required Plugins Installer', 'azera-shop' ),
'plugin_activated' => esc_html__( 'Plugin activated successfully.', 'azera-shop' ),
'complete' => esc_html__( 'All plugins installed and activated successfully. %s', 'azera-shop' ),
'nag_type' => 'updated'
)
);
tgmpa( $plugins, $config );
}
add_action('wp_footer','azera_shop_php_style', 100);
function azera_shop_php_style() {
echo '';
}
$pro_functions_path = azera_shop_get_file('/pro/functions.php');
if (file_exists($pro_functions_path)) {
require $pro_functions_path;
}
function azera_shop_get_file($file){
$file_parts = pathinfo($file);
$accepted_ext = array('jpg','img','png','css','js');
if( in_array($file_parts['extension'], $accepted_ext) ){
$file_path = get_stylesheet_directory() . $file;
if ( file_exists( $file_path ) ){
return esc_url(get_stylesheet_directory_uri() . $file);
} else {
return esc_url(get_template_directory_uri() . $file);
}
}
}
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
add_filter( 'woocommerce_output_related_products_args', 'azera_shop_related_products_args' );
function azera_shop_related_products_args( $args ) {
$args['posts_per_page'] = 4;
$args['columns'] = 4;
return $args;
}
function azera_shop_responsive_embed($html, $url, $attr, $post_ID) {
$return = '