tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'azera-shop' ), 'azera_shop_footer_menu' => esc_html__( 'Footer Menu', 'azera-shop' ), ) ); /** * Switch default core markup for search form, comment form, and comments */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'azera_shop_custom_background_args', array( 'default-repeat' => 'no-repeat', 'default-position-x' => 'center', 'default-attachment' => 'fixed', ) ) ); /* * This feature enables Custom_Headers support for a theme as of Version 3.4. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Header */ add_theme_support( 'custom-header', apply_filters( 'azera_shop_custom_header_args', array( 'default-image' => azera_shop_get_file( '/images/background-images/background.jpg' ), 'width' => 1000, 'height' => 680, 'flex-height' => true, 'flex-width' => true, 'header-text' => false, ) ) ); register_default_headers( array( 'azera_shop_default_header_image' => array( 'url' => azera_shop_get_file( '/images/background-images/background.jpg' ), 'thumbnail_url' => azera_shop_get_file( '/images/background-images/background_thumbnail.jpg' ), ), ) ); // Theme Support for WooCommerce add_theme_support( 'woocommerce' ); if ( class_exists( 'WooCommerce' ) ) { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); /* Set the image size by cropping the image */ add_image_size( 'azera-shop-post-thumbnail-big', 730, 340, true ); add_image_size( 'azera-shop-post-thumbnail-mobile', 500, 233, true ); add_image_size( 'azera_shop_home_prod', 350, 350, true ); /** * Welcome screen */ if ( is_admin() ) { global $azera_shop_required_actions; /** * Variable used: * id - unique id; required * title * description * check - check for plugins (if installed) * plugin_slug - the plugin's slug (used for installing the plugin) */ $azera_shop_required_actions = array( array( 'id' => 'azera-shop-req-ac-check-front-page', 'title' => esc_html__( 'Switch "Front page displays" to "A static page" ', 'azera-shop' ), 'description' => esc_html__( 'In order to have the one page look for your website, please go to Customize -> Advanced Options -> Static Front Page and switch "Front page displays" to "A static page". Then select the template "Frontpage" for that selected page.', 'azera-shop' ), 'check' => azera_shop_is_not_static_page(), ), array( 'id' => 'azera-shop-req-ac-install-intergeo-maps', 'title' => esc_html__( 'Install Intergeo Maps - Google Maps Plugin', 'azera-shop' ), 'description' => esc_html__( 'In order to use map section, you need to install Intergeo Maps plugin then use it to create a map and paste the generated shortcode in Customize -> Contact section -> Map shortcode', 'azera-shop' ), 'check' => defined( 'INTERGEO_PLUGIN_NAME' ), 'plugin_slug' => 'intergeo-maps', ), ); require get_template_directory() . '/inc/admin/welcome-screen/welcome-screen.php'; } /* * Notifications in customize */ if ( ! defined( 'AZERA_SHOP_PLUS_VERSION' ) ) { require get_template_directory() . '/ti-customizer-notify/class-ti-customizer-notify.php'; $config_customizer = array( 'recommended_plugins' => array( 'azera-shop-companion' => array( 'recommended' => true, /* translators: Theme companion install link */ 'description' => sprintf( esc_html__( 'If you want to take full advantage of the options this theme has to offer, please install and activate %s', 'azera-shop' ), sprintf( '%s', 'Azera Shop Companion' ) ), ), ), 'recommended_actions' => array(), 'recommended_actions_title' => '', 'recommended_plugins_title' => esc_html__( 'Recommended Plugins', 'azera-shop' ), 'install_button_label' => esc_html__( 'Install', 'azera-shop' ), 'activate_button_label' => esc_html__( 'Activate', 'azera-shop' ), 'deactivate_button_label' => esc_html__( 'Deactivate', 'azera-shop' ), ); Ti_Customizer_Notify::init( $config_customizer ); } } endif; // azera_shop_setup add_action( 'after_setup_theme', 'azera_shop_setup' ); /** * Function to check if frontpage is not static page. * * @return bool */ function azera_shop_is_not_static_page() { $azera_shop_is_not_static = 1; if ( 'page' == get_option( 'show_on_front' ) ) { $azera_shop_front_page_id = get_option( 'page_on_front' ); $azera_shop_template_name = get_page_template_slug( $azera_shop_front_page_id ); if ( ! empty( $azera_shop_template_name ) && ( $azera_shop_template_name == 'template-frontpage.php' ) ) { $azera_shop_is_not_static = 0; } } return ( ! $azera_shop_is_not_static ? true : false ); } /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function azera_shop_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'azera-shop' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => apply_filters( 'azera_shop_widgets_before_title', '

' ), 'after_title' => apply_filters( 'azera_shop_widgets_after_title', '

' ), ) ); if ( class_exists( 'WooCommerce' ) ) { register_sidebar( array( 'name' => esc_html__( 'WooCommerce Sidebar', 'azera-shop' ), 'id' => 'sidebar-woocommerce', 'before_widget' => '', 'before_title' => apply_filters( 'azera_shop_widgets_before_title', '

' ), 'after_title' => apply_filters( 'azera_shop_widgets_after_title', '

' ), ) ); } register_sidebars( 4, array( /* translators: footer area number */ 'name' => esc_html__( 'Footer area %d', 'azera-shop' ), 'id' => 'footer-area', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } 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( 'azera-shop-font', '//fonts.googleapis.com/css?family=Cabin:400,600|Open+Sans:400,300,600' ); wp_enqueue_style( 'azera-shop-fontawesome', azera_shop_get_file( '/css/font-awesome.min.css' ), array(), '4.4.0' ); wp_enqueue_style( 'azera-shop-bootstrap-style', azera_shop_get_file( '/css/bootstrap.min.css' ), array(), '3.3.1' ); wp_enqueue_style( 'azera-shop-style', get_stylesheet_uri(), array( 'azera-shop-bootstrap-style' ), '1.0.0' ); wp_enqueue_script( 'azera-shop-bootstrap', azera_shop_get_file( '/js/bootstrap.min.js' ), array(), '3.3.5', true ); wp_enqueue_script( 'azera-shop-custom-all', azera_shop_get_file( '/js/custom.all.js' ), array( 'jquery' ), '2.0.2', true ); wp_localize_script( 'azera-shop-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( 'azera-shop-home-plugin', azera_shop_get_file( '/js/plugin.home.js' ), array( 'jquery', 'azera-shop-custom-all' ), '1.0.1', true ); } if ( is_page_template( 'template-frontpage.php' ) ) { wp_enqueue_script( 'azera-shop-custom-home', azera_shop_get_file( '/js/custom.home.js' ), array( 'jquery' ), '1.0.0', true ); $azera_shop_cart_url = ''; if ( class_exists( 'WooCommerce' ) ) { $cart_url = wc_get_cart_url(); if ( ! empty( $cart_url ) ) { $azera_shop_cart_url = $cart_url; } } wp_localize_script( 'azera-shop-custom-home', 'viewcart', array( 'view_cart_label' => esc_html__( 'View cart', 'azera-shop' ), 'view_cart_link' => $azera_shop_cart_url, ) ); } wp_enqueue_script( 'azera-shop-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' ); /** * 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'; /** * Customizer info */ require_once get_template_directory() . '/inc/customize-info/class/class-azera-shop-customize-upsell.php'; /** * Translations */ require get_template_directory() . '/inc/translations/general.php'; /** * Admin scripts. */ function azera_shop_admin_scripts() { wp_enqueue_style( 'azera-shop-admin-fontawesome', azera_shop_get_file( '/css/font-awesome.min.css' ), array(), '4.5.0' ); wp_enqueue_style( 'azera-shop-admin-stylesheet', azera_shop_get_file( '/css/admin-style.css' ), '1.0.0' ); wp_enqueue_script( 'azera-shop-customizer-script', azera_shop_get_file( '/js/azera_shop_customizer.js' ), array( 'jquery', 'jquery-ui-draggable' ), '1.0.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'azera_shop_admin_scripts', 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_trigger_shop_page', 10 ); add_action( 'woocommerce_after_main_content', 'azera_shop_wrapper_end_shop_page', 10 ); /** * Wrapper start for content. * * @param string $class class name. * @param bool $is_blog if is blog. */ function azera_shop_wrapper_start( $class = 'col-md-12', $is_blog = false ) { $page_bg_image_url = get_background_image(); $class_to_add = ''; if ( ! empty( $page_bg_image_url ) && ! is_page_template( 'template-frontpage.php' ) ) { $class_to_add = 'content-background'; } ?>
'Intergeo Maps - Google Maps Plugin', 'slug' => 'intergeo-maps', 'required' => false, ), array( 'name' => 'Pirate Forms', 'slug' => 'pirate-forms', 'required' => false, ), array( 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false, ), array( 'name' => 'Azera Shop Companion', 'slug' => 'azera-shop-companion', 'required' => false, ), ); $config = array( 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', ); tgmpa( $plugins, $config ); } add_action( 'wp_footer', 'azera_shop_php_style', 100 ); /** * Inline style. */ function azera_shop_php_style() { $custom_css = ''; $azera_shop_title_color = get_theme_mod( 'azera_shop_title_color' ); $azera_shop_text_color = get_theme_mod( 'azera_shop_text_color' ); $azera_shop_enable_move = get_theme_mod( 'azera_shop_enable_move' ); $azera_shop_frontpage_opacity = get_theme_mod( 'azera_shop_frontpage_opacity', apply_filters( 'azera_shop_frontpage_opacity_filter', 'rgba(0, 0, 0, 0.1)' ) ); $azera_shop_blog_opacity = get_theme_mod( 'azera_shop_blog_opacity', apply_filters( 'azera_shop_blog_opacity_filter', 'rgba(0, 0, 0, 0.1)' ) ); $azera_shop_header_image = get_header_image(); if ( ! empty( $azera_shop_title_color ) ) { $custom_css .= '.dark-text { color: ' . $azera_shop_title_color . ' }'; } if ( ! empty( $azera_shop_text_color ) ) { $custom_css .= 'body{ color: ' . $azera_shop_text_color . '}'; } if ( ( empty( $azera_shop_enable_move ) || ! $azera_shop_enable_move ) && ( is_front_page() || is_page_template( 'template-frontpage.php' ) ) ) { if ( ! empty( $azera_shop_header_image ) ) { $custom_css .= '.header{ background-image: url(' . $azera_shop_header_image . ');}'; } } if ( ! empty( $azera_shop_frontpage_opacity ) ) { $custom_css .= '.overlay-layer-wrap{ background:' . $azera_shop_frontpage_opacity . ';}'; } if ( ! empty( $azera_shop_blog_opacity ) ) { $custom_css .= '.archive-top .section-overlay-layer{ background:' . $azera_shop_blog_opacity . ';}'; } wp_add_inline_style( 'azera-shop-style', $custom_css ); } add_action( 'wp_enqueue_scripts', 'azera_shop_php_style', 100 ); $pro_functions_path = azera_shop_get_file( '/pro/functions.php' ); if ( file_exists( $pro_functions_path ) ) { require $pro_functions_path; } /** * Get file. * * @param string $file link of the file. * * @return mixed */ 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' ); /** * Related produts arguments. * * @param array $args array with arguments. * * @return mixed */ function azera_shop_related_products_args( $args ) { $args['posts_per_page'] = 4; $args['columns'] = 4; return $args; } /** * Video container. * * @param string $html html to add. * @param string $url url. * @param string $attr attribute name. * @param int $post_id id of the post. * * @return string */ function azera_shop_responsive_embed( $html, $url, $attr, $post_id ) { $return = '
' . $html . '
'; return $return; } add_filter( 'embed_oembed_html', 'azera_shop_responsive_embed', 10, 4 ); /** * Comments callback function * * @param string $comment comment content. * @param array $args arguments. * @param int $depth depth of the comments. */ function azera_shop_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback': case 'trackback': ?>
  • id="li-comment-">
    %s says:', 'azera-shop' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'], ) ) ); ?>
    id ) ) { $id = $azera_shop_logo_box->id; } if ( ! empty( $azera_shop_logo_box->image_url ) ) { $image = $azera_shop_logo_box->image_url; } if ( ! empty( $azera_shop_logo_box->link ) ) { $link = $azera_shop_logo_box->link; } if ( ! empty( $id ) ) { if ( ! empty( $image ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_logo_image', $image, 'Logos' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Logos section', 'Logo image ' . $id, $image ); } } if ( ! empty( $link ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_logo_link', $link, 'Logos' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Logos section', 'Logo link ' . $id, $link ); } } } } } /*Shortcode section*/ $azera_shop_shortcodes_section = get_theme_mod( 'azera_shop_shortcodes_settings' ); if ( ! empty( $azera_shop_shortcodes_section ) ) { $azera_shop_shortcodes_section_decoded = json_decode( $azera_shop_shortcodes_section ); foreach ( $azera_shop_shortcodes_section_decoded as $azera_shop_shortcodes_box ) { $id = ''; $title = ''; $subtitle = ''; $shortcode = ''; if ( ! empty( $azera_shop_shortcodes_box->id ) ) { $id = $azera_shop_shortcodes_box->id; } if ( ! empty( $azera_shop_shortcodes_box->title ) ) { $title = $azera_shop_shortcodes_box->title; } if ( ! empty( $azera_shop_shortcodes_box->subtitle ) ) { $subtitle = $azera_shop_shortcodes_box->subtitle; } if ( ! empty( $azera_shop_shortcodes_box->shortcode ) ) { $shortcode = $azera_shop_shortcodes_box->shortcode; } if ( ! empty( $id ) ) { if ( ! empty( $title ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_shortcode_section_title', $title, 'Shortcodes section' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Shortcodes section', 'Shortcode title ' . $id, $title ); } } if ( ! empty( $subtitle ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_shortcode_section_subtitle', $subtitle, 'Shortcodes section' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Shortcodes section', 'Shortcode subtitle ' . $id, $subtitle ); } } if ( ! empty( $shortcode ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_shortcode_section_shortcode', $shortcode, 'Shortcodes section' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Shortcodes section', 'Shortcode ' . $id, $shortcode ); } } } }// End foreach(). }// End if(). /*Footer*/ $azera_shop_social_icons = get_theme_mod( 'azera_shop_social_icons' ); if ( ! empty( $azera_shop_social_icons ) ) { $azera_shop_social_icons_decoded = json_decode( $azera_shop_social_icons ); foreach ( $azera_shop_social_icons_decoded as $azera_shop_footer_social ) { $id = ''; $link = ''; $icon = ''; if ( ! empty( $azera_shop_footer_social->id ) ) { $id = esc_attr( $azera_shop_footer_social->id ); } if ( ! empty( $azera_shop_footer_social->link ) ) { $link = $azera_shop_footer_social->link; } if ( ! empty( $azera_shop_footer_social->icon_value ) ) { $icon = $azera_shop_footer_social->icon_value; } if ( ! empty( $id ) ) { if ( ! empty( $icon ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_footer_icon', $icon, 'Footer' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Footer', 'Footer social icon ' . $id, $icon ); } } if ( ! empty( $link ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_footer_link', $link, 'Footer' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Footer', 'Footer social link ' . $id, $link ); } } } } } /** * Contact */ $azera_shop_contact = get_theme_mod( 'azera_shop_contact_info_content' ); if ( ! empty( $azera_shop_contact ) ) { $azera_shop_contact_decoded = json_decode( $azera_shop_contact ); foreach ( $azera_shop_contact_decoded as $azera_shop_contact_box ) { $id = ''; $icon = ''; $text = ''; $link = ''; if ( ! empty( $azera_shop_contact_box->id ) ) { $id = esc_attr( $azera_shop_contact_box->id ); } if ( ! empty( $azera_shop_contact_box->icon_value ) ) { $icon = $azera_shop_contact_box->icon_value; } if ( ! empty( $azera_shop_contact_box->text ) ) { $text = $azera_shop_contact_box->text; } if ( ! empty( $azera_shop_contact_box->link ) ) { $link = $azera_shop_contact_box->link; } if ( ! empty( $id ) ) { if ( ! empty( $icon ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_contact_icon', $icon, 'Contact' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Contact section', 'Contact box icon ' . $id, $icon ); } } if ( ! empty( $link ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_contact_link', $link, 'Contact' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Contact section', 'Contact box link ' . $id, $link ); } } if ( ! empty( $text ) ) { if ( function_exists( 'pll_register_string' ) ) { pll_register_string( $id . '_contact_text', $text, 'Contact' ); } else { do_action( 'wpml_register_single_string', 'Azera Shop -> Contact section', 'Contact box text ' . $id, $text ); } } } }// End foreach(). }// End if(). }// End if(). /** * Template part. * * @param string $template template name. */ function azera_shop_get_template_part( $template ) { if ( locate_template( $template . '.php' ) ) { get_template_part( $template ); } else { if ( defined( 'AZERA_SHOP_PLUS_PATH' ) ) { if ( file_exists( AZERA_SHOP_PLUS_PATH . 'public/templates/' . $template . '.php' ) ) { require_once( AZERA_SHOP_PLUS_PATH . 'public/templates/' . $template . '.php' ); } } else { if ( defined( 'AZERA_SHOP_COMPANION_PATH' ) ) { if ( file_exists( AZERA_SHOP_COMPANION_PATH . 'sections/' . $template . '.php' ) ) { require_once( AZERA_SHOP_COMPANION_PATH . 'sections/' . $template . '.php' ); } } } } } /** * More link. * * @param string $more more text. * * @return string */ function azera_shop_excerpt_more( $more ) { global $post; return '' . esc_html__( 'Read more about ', 'azera-shop' ) . esc_html( get_the_title() ) . '[…]'; } add_filter( 'excerpt_more', 'azera_shop_excerpt_more' ); add_filter( 'woocommerce_add_to_cart_fragments', 'azera_shop_woocommerce_header_add_to_cart_fragment' ); /** * Ensure cart contents update when products are added to the cart via AJAX) * * @param array $fragments array with content to add. * * @return mixed */ function azera_shop_woocommerce_header_add_to_cart_fragment( $fragments ) { ob_start(); ?> cart->get_cart_contents_count() ); ?> '; } else { echo ''; } } }// End if(). add_action( 'blog_header', 'azera_shop_blog_header' ); if ( ! function_exists( 'azera_shop_footer_powered_by' ) ) { /** * Display the powered by section in the footer */ function azera_shop_footer_powered_by() { ?>
    %s', esc_html__( 'Azera Shop', 'azera-shop' ) ), sprintf( '%s', esc_html__( 'WordPress', 'azera-shop' ) ) ); ?>
    array( 'home' => array( 'template' => 'template-frontpage.php', ), 'blog', ), 'nav_menus' => array( 'primary' => array( 'name' => __( 'Primary Menu', 'azera-shop' ), 'items' => array( 'page_home', 'page_blog', ), ), ), 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), ) ); } add_action( 'after_setup_theme', 'azera_shop_starter_content' ); /** * Notice in Customize to announce the theme is not maintained anymore */ function azera_shop_customize_register_notification( $wp_customize ) { require_once( 'inc/class/class-ti-notify.php' ); $wp_customize->register_section_type( 'Ti_Notify' ); $wp_customize->add_section( new Ti_Notify( $wp_customize, 'ti-notify', array( /* translators: Link to the recommended theme */ 'text' => sprintf( __( 'This theme is not maintained anymore, check-out our latest free one-page theme: %1$s or our best woocommerce theme %2$s.', 'azera-shop' ), sprintf( '%s', 'Hestia' ), sprintf( '%s', 'Shop Isle' ) ), 'priority' => 0, ) ) ); $wp_customize->add_setting( 'azera-shop-notify', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'azera-shop-notify', array( 'label' => __( 'Notification', 'azera-shop' ), 'section' => 'ti-notify', 'priority' => 1, ) ); } add_action( 'customize_register', 'azera_shop_customize_register_notification' ); /** * Notice in admin dashboard to announce the theme is not maintained anymore */ function azera_shop_admin_notice() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { echo '

    '; printf( /* translators: link to the recommended theme */ __( 'This theme is not maintained anymore, check-out our latest free one-page theme: %1$s or our best woocommerce theme %2$s.', 'azera-shop' ), sprintf( '%s', 'Hestia' ), sprintf( '%s', 'Shop Isle' ) ); echo '

    '; } } add_action( 'admin_notices', 'azera_shop_admin_notice', 99 );