tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); add_image_size( 'adventeqa-home-recent-posts', 600, 9999 ); add_image_size( 'adventeqa-ecomproduct', 720, 450, true ); add_image_size( 'adventeqa-ecomproduct-new', 900, 700, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'adventeqa' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'adventeqa_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); add_post_type_support( 'page', 'excerpt' ); // Enable WooCommerce. add_theme_support( 'woocommerce' ); add_filter( 'woocommerce_enqueue_styles', '__return_false' ); } endif; add_action( 'after_setup_theme', 'adventeqa_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function adventeqa_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'adventeqa_content_width', 640 ); } add_action( 'after_setup_theme', 'adventeqa_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function adventeqa_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'adventeqa' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'adventeqa' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Left Widget Area', 'adventeqa' ), 'id' => 'footer-left', 'description' => esc_html__( 'Add widgets here.', 'adventeqa' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Middle Widget Area', 'adventeqa' ), 'id' => 'footer-middle', 'description' => esc_html__( 'Add widgets here.', 'adventeqa' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Right Widget Area', 'adventeqa' ), 'id' => 'footer-right', 'description' => esc_html__( 'Add widgets here.', 'adventeqa' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'adventeqa_widgets_init' ); /** * Enqueue scripts and styles. */ function adventeqa_scripts() { wp_enqueue_style( 'adventeqa-fonts', '//fonts.googleapis.com/css?family=Montserrat:400,600,700,800|Open+Sans:400,600,700' ); wp_enqueue_style( 'adventeqa-style', get_stylesheet_uri() ); wp_enqueue_style( 'adventeqa-slider-css', get_template_directory_uri() . '/assets/css/slider/owl.carousel.css' ); wp_enqueue_style( 'adventeqa-slider-theme', get_template_directory_uri() . '/assets/css/slider/owl.theme.css' ); wp_enqueue_style( 'adventeqa-slider-transitions', get_template_directory_uri() . '/assets/css/slider/owl.transitions.css' ); wp_enqueue_script( 'adventeqa-owl', get_template_directory_uri() . '/assets/js/owl.carousel.js', array('jquery'), '20151215', true ); wp_enqueue_style( 'adventeqa-app-css', get_template_directory_uri() . '/assets/css/app/style.css' ); wp_enqueue_script( 'adventeqa-app', get_template_directory_uri() . '/assets/js/app/script.js', array('jquery'), '20151215', true ); wp_register_script( 'adventeqa-general', get_template_directory_uri() . '/assets/js/general.js' ); $adventeqa_js_variable_array = array( 'frontpage' => false, ); if( 'page2.php' == get_page_template_slug() ){ $adventeqa_js_variable_array['frontpage'] = true; } wp_localize_script( 'adventeqa-general', 'adventeqaJs', $adventeqa_js_variable_array ); wp_enqueue_script( 'adventeqa-general', '', array('jquery'), '20151215', true ); wp_enqueue_script( 'adventeqa-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'adventeqa_scripts' ); function adventeqa_title( $title ) { if ( '' == $title ) { return __('no title', 'adventeqa' ); } return $title; } add_filter( 'the_title', 'adventeqa_title', 10, 2 ); function adventeqa_limitedstring($output, $max_char=100){ $output = str_replace(']]>', ']]>', $output); $output = strip_tags($output); $output = strip_shortcodes($output); if ((strlen($output)>$max_char)){ $output = substr($output, 0, $max_char); return $output; }else{ return $output; } } function adventeqa_get_random_post(){ $output = get_posts( array( 'numberposts' => 1, 'orderby' => 'rand', 'fields' => 'ids', ) ); return $output[0]; } function adventeqa_woo_pagination( $paged = '', $max_page = '' ){ $big = 999999999; // need an unlikely integer if( ! $paged ) $paged = get_query_var('paged'); if( ! $max_page ) $max_page = $wp_query->max_num_pages; echo wp_kses( paginate_links( array( 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link( $big ))), 'format' => '?paged=%#%', 'current' => max( 1, $paged ), 'total' => $max_page, 'mid_size' => 1, 'prev_text' => __('«', 'adventeqa'), 'next_text' => __('»', 'adventeqa'), 'type' => 'list' ) ), array( 'a' => array( 'href' => array(), 'class' => array(), 'title' => array() ), 'ul' => array( 'class' => array(), ), 'li' => array( 'class' => array(), ), 'span' => array( 'class' => array(), 'aria-current' => array(), ), ) ); } function adventeqa_product_slider(){ add_meta_box( 'adventeqa_product_slider', __( 'Adventeqa Slider Settings', 'adventeqa' ), 'adventeqa_product_slider_display_callback', 'product', 'side', 'high', null ); } add_action( 'add_meta_boxes', 'adventeqa_product_slider' ); $adventeqa_meta_options = array( 'slider_show' => array( 'select' => __( "Select", "adventeqa" ), 'yes' => __( "Yes", "adventeqa" ), 'no' => __( "No", "adventeqa" ), ), 'slider_type' => array( 'select' => __( "Select", "adventeqa" ), 'one' => __( "One", "adventeqa" ), 'two' => __( "Two", "adventeqa" ), 'three' => __( "Three", "adventeqa" ), ), 'overlay_type' => array( 'select' => __( "Select", "adventeqa" ), 'black' => __( "Black", "adventeqa" ), 'blue' => __( "Blue", "adventeqa" ), 'green' => __( "Green", "adventeqa" ), 'red' => __( "Red", "adventeqa" ), 'purple' => __( "Purple", "adventeqa" ), ), 'bg_position' => array( 'select' => __( "Select", "adventeqa" ), 'top right' => __( "Top Right", "adventeqa" ), 'top left' => __( "Top Left", "adventeqa" ), 'bottom right' => __( "Bottom Right", "adventeqa" ), 'bottom left' => __( "Bottom Left", "adventeqa" ), 'none' => __( "None", "adventeqa" ), ), ); function adventeqa_product_slider_display_callback($object){ wp_nonce_field(basename(__FILE__), "adventeqa-product-slider-nonce"); global $adventeqa_meta_options; echo '

'; echo '
'; echo '
'; echo '

'; echo '
'; echo '
'; echo '

'; echo '
'; echo '
'; echo '

'; echo '
'; } function adventeqa_product_slider_save_meta($post_id) { if (!isset($_POST["adventeqa-product-slider-nonce"]) || !wp_verify_nonce($_POST["adventeqa-product-slider-nonce"], basename(__FILE__))) return $post_id; global $adventeqa_meta_options; if(!current_user_can("edit_post", $post_id)) return $post_id; if(defined("DOING_AUTOSAVE") && DOING_AUTOSAVE) return $post_id; if ( isset( $_POST['post_type'] ) && "product" === $_POST['post_type'] ) { $adventeqa_show_in_product_slider_value = ""; if(isset($_POST["adventeqa_show_in_product_slider"]) && array_key_exists($_POST["adventeqa_show_in_product_slider"], $adventeqa_meta_options['slider_show'])){ $adventeqa_show_in_product_slider_value = $_POST["adventeqa_show_in_product_slider"]; } update_post_meta($post_id, "adventeqa_show_in_product_slider", $adventeqa_show_in_product_slider_value); $adventeqa_product_slide_type_value = ""; if(isset($_POST["adventeqa_product_slide_type"]) && array_key_exists($_POST["adventeqa_product_slide_type"], $adventeqa_meta_options['slider_type'])){ $adventeqa_product_slide_type_value = $_POST["adventeqa_product_slide_type"]; } update_post_meta($post_id, "adventeqa_product_slide_type", $adventeqa_product_slide_type_value); $adventeqa_product_slide_overlay_type_value = ""; if(isset($_POST["adventeqa_product_slide_overlay_type"]) && array_key_exists($_POST["adventeqa_product_slide_overlay_type"], $adventeqa_meta_options['overlay_type'])){ $adventeqa_product_slide_overlay_type_value = $_POST["adventeqa_product_slide_overlay_type"]; } update_post_meta($post_id, "adventeqa_product_slide_overlay_type", $adventeqa_product_slide_overlay_type_value); $adventeqa_product_slide_bg_position_value = ""; if(isset($_POST["adventeqa_product_slide_bg_position"]) && array_key_exists($_POST["adventeqa_product_slide_bg_position"], $adventeqa_meta_options['bg_position'])){ $adventeqa_product_slide_bg_position_value = $_POST["adventeqa_product_slide_bg_position"]; } update_post_meta($post_id, "adventeqa_product_slide_bg_position", $adventeqa_product_slide_bg_position_value); }else{ return $post_id; } } add_action( 'save_post', 'adventeqa_product_slider_save_meta' ); function adventeqa_add_show_option_woo_product_cat() { ?>

term_id; // retrieve the existing value(s) for this meta field. $adventeqa_value = esc_html(get_term_meta($term_id, 'adventeqa-show-on-front', true)); ?>

add( 'WPTRT\\Customize\\Section\\', get_template_directory() . '/inc/' ); $adventeqa_loader->add( 'WPTRT\\AdminNotices\\', get_template_directory() . '/inc/admin-notices/src/' ); // Register all loaders. $adventeqa_loader->register(); /* UpGrade */ require get_template_directory() . '/inc/upgrade.php'; /* Notices */ require get_template_directory() . '/inc/notices.php'; /* Guide */ require get_template_directory() . '/inc/theme-info.php';