__( 'Primary Menu', 'panoramic' ), 'footer' => __( 'Footer Menu', 'panoramic' ) ) ); /* * 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', ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', ) ); /* * Setup Custom Logo Support for theme * Supported from WordPress version 4.5 onwards * More Info: https://make.wordpress.org/core/2016/03/10/custom-logo/ */ if ( function_exists( 'has_custom_logo' ) ) { add_theme_support( 'custom-logo' ); } // The custom header is used if no slider is enabled add_theme_support( 'custom-header', array( 'default-image' => get_template_directory_uri() . '/library/images/headers/default.jpg', 'width' => 1500, 'height' => 445, 'flex-width' => true, 'flex-height' => true, 'header-text' => false, ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'panoramic_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); add_theme_support( 'title-tag' ); // Gutenberg Support add_theme_support( 'align-wide' ); add_theme_support( 'woocommerce', array( 'gallery_thumbnail_image_width' => 300 ) ); if ( get_theme_mod( 'panoramic-woocommerce-product-image-zoom', true ) ) { add_theme_support( 'wc-product-gallery-zoom' ); } add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } endif; // panoramic_theme_setup add_action( 'after_setup_theme', 'panoramic_theme_setup' ); /** * Enqueue admin scripts and styles. */ function panoramic_admin_scripts() { wp_enqueue_style( 'panoramic-admin-css', get_template_directory_uri() . '/library/css/admin.css', array(), PANORAMIC_THEME_VERSION ); wp_enqueue_script( 'panoramic-admin-js', get_template_directory_uri() . '/library/js/admin.js', PANORAMIC_THEME_VERSION, true ); } add_action( 'admin_enqueue_scripts', 'panoramic_admin_scripts' ); // Adjust content_width for full width pages function panoramic_adjust_content_width() { global $content_width; if ( panoramic_is_woocommerce_activated() && is_woocommerce() ) { $is_woocommerce = true; } else { $is_woocommerce = false; } if ( is_page_template( 'template-full-width.php' ) ) { $content_width = 1096; } else if ( ( is_page_template( 'template-left-sidebar.php' ) || basename( get_page_template() ) === 'page.php' ) && !is_active_sidebar( 'sidebar-1' ) ) { $content_width = 1096; } else if ( panoramic_is_woocommerce_activated() && is_shop() && get_theme_mod( 'panoramic-layout-woocommerce-shop-full-width', customizer_library_get_default( 'panoramic-layout-woocommerce-shop-full-width' ) ) ) { $content_width = 1096; } else if ( panoramic_is_woocommerce_activated() && is_product() && get_theme_mod( 'panoramic-layout-woocommerce-product-full-width', customizer_library_get_default( 'panoramic-layout-woocommerce-product-full-width' ) ) ) { $content_width = 1096; } else if ( panoramic_is_woocommerce_activated() && ( is_product_category() || is_product_tag() ) && get_theme_mod( 'panoramic-layout-woocommerce-category-tag-page-full-width', customizer_library_get_default( 'panoramic-layout-woocommerce-category-tag-page-full-width' ) ) ) { $content_width = 1096; } else if ( $is_woocommerce && !is_active_sidebar( 'sidebar-1' ) ) { $content_width = 1096; } } add_action( 'template_redirect', 'panoramic_adjust_content_width' ); function panoramic_review_notice() { $user_id = get_current_user_id(); $message = 'Thank you for using Panoramic! We hope you\'re enjoying the theme, please consider rating it on wordpress.org :)'; if ( !get_user_meta( $user_id, 'panoramic_review_notice_dismissed' ) ) { $class = 'notice notice-success is-dismissible'; printf( '
', esc_attr( $class ), $message ); } } $today = new DateTime( date( 'Y-m-d' ) ); $activate = new DateTime( date( get_theme_mod( 'otb_panoramic_activated' ) ) ); if ( $activate->diff($today)->d >= 14 ) { add_action( 'admin_notices', 'panoramic_review_notice' ); } function panoramic_review_notice_dismissed() { $user_id = get_current_user_id(); if ( isset( $_GET['panoramic-review-notice-dismissed'] ) ) { add_user_meta( $user_id, 'panoramic_review_notice_dismissed', 'true', true ); } } add_action( 'admin_init', 'panoramic_review_notice_dismissed' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function panoramic_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'panoramic' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => ''; echo __( 'Out of Stock', 'panoramic' ); echo '
'; } } /* if (!function_exists('woocommerce_template_loop_add_to_cart')) { function woocommerce_template_loop_add_to_cart( $args = array() ) { global $product; if (!$product->is_in_stock()) { echo ''; echo __( 'Out of Stock', 'panoramic' ); echo '
'; } else { $defaults = array( 'quantity' => 1, 'class' => implode( ' ', array_filter( array( 'button', 'product_type_' . $product->get_type(), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', $product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '' ) ) ) ); $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product ); wc_get_template( 'loop/add-to-cart.php', $args ); } } } */ function panoramic_excerpt_length( $length ) { return get_theme_mod( 'panoramic-blog-excerpt-length', customizer_library_get_default( 'panoramic-blog-excerpt-length' ) ); } add_filter( 'excerpt_length', 'panoramic_excerpt_length', 999 ); function panoramic_excerpt_more( $more ) { return ' ' . wp_kses_post( get_theme_mod( 'panoramic-blog-read-more-text', __('Read More', 'panoramic') ) ) . ''; } add_filter( 'excerpt_more', 'panoramic_excerpt_more' ); /** * Adjust is_home query if panoramic-slider-categories is set */ function panoramic_set_blog_queries( $query ) { $slider_categories = get_theme_mod( 'panoramic-slider-categories', '' ); $slider_type = get_theme_mod( 'panoramic-slider-type', customizer_library_get_default( 'panoramic-slider-type' ) ); if ( $slider_categories != '' && $slider_type == 'panoramic-slider-default' ) { $is_front_page = ( $query->get('page_id') == get_option('page_on_front') || is_front_page() ); if ( count($slider_categories) > 0) { // do not alter the query on wp-admin pages and only alter it if it's the main query if ( !is_admin() && !$is_front_page || !is_admin() && $is_front_page && $query->get('id') != 'slider' ){ $query->set( 'category__not_in', $slider_categories ); } } } } add_action( 'pre_get_posts', 'panoramic_set_blog_queries' ); function panoramic_filter_recent_posts_widget_parameters( $params ) { $slider_categories = get_theme_mod( 'panoramic-slider-categories', '' ); $slider_type = get_theme_mod( 'panoramic-slider-type', customizer_library_get_default( 'panoramic-slider-type' ) ); if ( $slider_categories != '' && $slider_type == 'panoramic-slider-default' ) { if ( count($slider_categories) > 0) { // do not alter the query on wp-admin pages and only alter it if it's the main query $params['category__not_in'] = $slider_categories; } } return $params; } add_filter('widget_posts_args','panoramic_filter_recent_posts_widget_parameters'); /** * Adjust the widget categories query if panoramic-slider-categories is set */ function panoramic_set_widget_categories_args($args){ $slider_categories = get_theme_mod( 'panoramic-slider-categories', '' ); $slider_type = get_theme_mod( 'panoramic-slider-type', customizer_library_get_default( 'panoramic-slider-type' ) ); if ( $slider_categories != '' && $slider_type == 'panoramic-slider-default' ) { if ( count($slider_categories) > 0) { $exclude = implode(',', $slider_categories); $args['exclude'] = $exclude; } } return $args; } add_filter('widget_categories_args', 'panoramic_set_widget_categories_args'); function panoramic_set_widget_categories_dropdown_arg($args){ $slider_categories = get_theme_mod( 'panoramic-slider-categories', '' ); $slider_type = get_theme_mod( 'panoramic-slider-type', customizer_library_get_default( 'panoramic-slider-type' ) ); if ( $slider_categories != '' && $slider_type == 'panoramic-slider-default' ) { if ( count($slider_categories) > 0) { $exclude = implode(',', $slider_categories); $args['exclude'] = $exclude; } } return $args; } add_filter('widget_categories_dropdown_args', 'panoramic_set_widget_categories_dropdown_arg'); function panoramic_allowed_tags() { global $allowedtags; $allowedtags["h1"] = array(); $allowedtags["h2"] = array(); $allowedtags["h3"] = array(); $allowedtags["h4"] = array(); $allowedtags["h5"] = array(); $allowedtags["h6"] = array(); $allowedtags["p"] = array(); $allowedtags["br"] = array(); $allowedtags["a"] = array( 'href' => true, 'class' => true, ); $allowedtags["i"] = array( 'class' => true, ); } add_action('init', 'panoramic_allowed_tags', 10); function panoramic_register_required_plugins() { $plugins = array( array( 'name' => 'Elementor Page Builder', 'slug' => 'elementor', 'required' => false ), array( 'name' => 'Page Builder by SiteOrigin', 'slug' => 'siteorigin-panels', 'required' => false ), array( 'name' => 'SiteOrigin Widgets Bundle', 'slug' => 'so-widgets-bundle', 'required' => false ), array( 'name' => 'Recent Posts Widget Extended', 'slug' => 'recent-posts-widget-extended', 'required' => false ), array( 'name' => 'SiteOrigin CSS', 'slug' => 'so-css', 'required' => false ), array( 'name' => 'WPForms', 'slug' => 'wpforms-lite', 'required' => false ), array( 'name' => 'Photo Gallery by Supsystic', 'slug' => 'gallery-by-supsystic', 'required' => false ), array( 'name' => 'Breadcrumb NavXT', 'slug' => 'breadcrumb-navxt', 'required' => false ), array( 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false ), array( 'name' => 'Instagram Slider Widget', 'slug' => 'instagram-slider-widget', 'required' => false ), array( 'name' => 'Anti-Spam', 'slug' => 'anti-spam', 'required' => false ), array( 'name' => 'Yoast SEO', 'slug' => 'wordpress-seo', 'required' => false ) ); $config = array( 'id' => 'panoramic', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => get_stylesheet_directory() .'/library/plugins/', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '' // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } add_action( 'tgmpa_register', 'panoramic_register_required_plugins' ); if ( function_exists( 'pll_register_string' ) ) { /** * Register some string from the customizer to be translated with Polylang */ function panoramic_pll_register_string() { // Header pll_register_string( 'panoramic-header-info-text-one', get_theme_mod( 'panoramic-header-info-text-one' ), 'panoramic', false ); // Search pll_register_string( 'panoramic-search-placeholder-text', get_theme_mod( 'panoramic-search-placeholder-text' ), 'panoramic', false ); pll_register_string( 'panoramic-website-text-no-search-results-heading', get_theme_mod( 'panoramic-website-text-no-search-results-heading' ), 'panoramic', false ); pll_register_string( 'panoramic-website-text-no-search-results-text', get_theme_mod( 'panoramic-website-text-no-search-results-text' ), 'panoramic', true ); // Header media pll_register_string( 'panoramic-header-image-text', get_theme_mod( 'panoramic-header-image-text' ), 'panoramic', true ); // Blog read more pll_register_string( 'panoramic-blog-read-more-text', get_theme_mod( 'panoramic-blog-read-more-text' ), 'panoramic', true ); // 404 pll_register_string( 'panoramic-website-text-404-page-heading', get_theme_mod( 'panoramic-website-text-404-page-heading' ), 'panoramic', true ); pll_register_string( 'panoramic-website-text-404-page-text', get_theme_mod( 'panoramic-website-text-404-page-text' ), 'panoramic', true ); } add_action( 'after_setup_theme', 'panoramic_pll_register_string' ); }