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( 'blank-x-featured-image', 2000, 1200, true ); add_image_size( 'blank-x-thumbnail-avatar', 100, 100, true ); // Set the default content width. $GLOBALS['content_width'] = 525; // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'top' => __( 'Top Menu', 'blank-x' ), 'social' => __( 'Social Links Menu', 'blank-x' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); wp_list_comments( $args,'wp_list_comments'); ?> /* * Enable support for Post Formats. * * See: https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'audio', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 250, 'height' => 250, 'flex-width' => true, ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css', blank_x_fonts_url() ) ); // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( // Place three core-defined widgets in the sidebar area. 'sidebar-1' => array( 'text_business_info', 'search', 'text_about', ), // Add the core-defined business info widget to the footer 1 area. 'sidebar-2' => array( 'text_business_info', ), // Put two core-defined widgets in the footer 2 area. 'sidebar-3' => array( 'text_about', 'search', ), ), // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'home', 'about' => array( 'thumbnail' => '{{image-sandwich}}', ), 'contact' => array( 'thumbnail' => '{{image-espresso}}', ), 'blog' => array( 'thumbnail' => '{{image-coffee}}', ), 'homepage-section' => array( 'thumbnail' => '{{image-espresso}}', ), ), // Create the custom image attachments used as post thumbnails for pages. 'attachments' => array( 'image-espresso' => array( 'post_title' => _x( 'Espresso', 'Theme starter content', 'blank-x' ), 'file' => 'assets/images/espresso.jpg', // URL relative to the template directory. ), 'image-sandwich' => array( 'post_title' => _x( 'Sandwich', 'Theme starter content', 'blank-x' ), 'file' => 'assets/images/sandwich.jpg', ), 'image-coffee' => array( 'post_title' => _x( 'Coffee', 'Theme starter content', 'blank-x' ), 'file' => 'assets/images/coffee.jpg', ), ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set the front page section theme mods to the IDs of the core-registered pages. 'theme_mods' => array( 'panel_1' => '{{homepage-section}}', 'panel_2' => '{{about}}', 'panel_3' => '{{blog}}', 'panel_4' => '{{contact}}', ), // Set up nav menus for each of the two areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "top" location. 'top' => array( 'name' => __( 'Top Menu', 'blank-x' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_about', 'page_blog', 'page_contact', ), ), // Assign a menu to the "social" location. 'social' => array( 'name' => __( 'Social Links Menu', 'blank-x' ), 'items' => array( 'link_yelp', 'link_facebook', 'link_twitter', 'link_instagram', 'link_email', ), ), ), ); /** * Filters blank-x array of starter content. * * @since blank-x 1.1 * * @param array $starter_content Array of starter content. */ $starter_content = apply_filters( 'blank_x_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } add_action( 'after_setup_theme', 'blank_x_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 blank_x_content_width() { $content_width = $GLOBALS['content_width']; // Get layout. $page_layout = get_theme_mod( 'page_layout' ); // Check if layout is one column. if ( 'one-column' === $page_layout ) { if ( blank_x_is_frontpage() ) { $content_width = 644; } elseif ( is_page() ) { $content_width = 740; } } // Check if is single post and there is no sidebar. if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) { $content_width = 740; } /** * Filter blank-x content width of the theme. * * @since blank-x 1.0 * * @param int $content_width Content width in pixels. */ $GLOBALS['content_width'] = apply_filters( '_content_width', $content_width ); } add_action( 'template_redirect', 'blank_x_content_width', 0 ); /** * Register custom fonts. */ function blank_x_fonts_url() { $fonts_url = ''; /* * Translators: If there are characters in your language that are not * supported by Libre Franklin, translate this to 'off'. Do not translate * into your own language. */ $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'blank-x' ); if ( 'off' !== $libre_franklin ) { $font_families = array(); $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Add preconnect for Google Fonts. * * @since blank-x 1.1 * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed. * @return array $urls URLs to print for resource hints. */ function blank_x_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'blank-x-fonts', 'queue' ) && 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter( 'wp_resource_hints', 'blank_x_resource_hints', 10, 2 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function blank_x_widgets_init() { register_sidebar( array( 'name' => __( 'Blog Sidebar', 'blank-x' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'blank-x' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 1', 'blank-x' ), 'id' => 'sidebar-2', 'description' => __( 'Add widgets here to appear in your footer.', 'blank-x' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 2', 'blank-x' ), 'id' => 'sidebar-3', 'description' => __( 'Add widgets here to appear in your footer.', 'blank-x' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'blank_x_widgets_init' ); /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Continue reading' link. * * @since blank-x 1.1 * * @param string $link Link to single post/page. * @return string 'Continue reading' link prepended with an ellipsis. */ function blank_x_excerpt_more( $link ) { if ( is_admin() ) { return $link; } $link = sprintf( '', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading "%s"', 'blank-x' ), get_the_title( get_the_ID() ) ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'blank_x_excerpt_more' ); /** * Handles JavaScript detection. * * Adds a `js` class to the root `` element when JavaScript is detected. * * @since blank-x 1.1 */ function blank_x_javascript_detection() { echo "\n"; } add_action( 'wp_head', 'blank_x_javascript_detection', 0 ); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blank_x_pingback_header() { if ( is_singular() && pings_open() ) { printf( '' . "\n", get_bloginfo( 'pingback_url' ) ); } } add_action( 'wp_head', 'blank_x_pingback_header' ); /** * Display custom color CSS. */ function blank_x_colors_css_wrap() { if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) { return; } require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) ); ?> blank_x_get_svg( array( 'icon' => 'quote-right' ) ), ); if ( has_nav_menu( 'top' ) ) { wp_enqueue_script( 'blank-x-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '1.0', true ); $blank_x_l10n['expand'] = __( 'Expand child menu', 'blank-x' ); $blank_x_l10n['collapse'] = __( 'Collapse child menu', 'blank-x' ); // $blank_x_l10n['icon'] = blank_x_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) ); } wp_enqueue_script( 'blank-x-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true ); wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.2', true ); wp_localize_script( 'blank-x-skip-link-focus-fix', 'blank-xScreenReaderText', $blank_x_l10n ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'blank_x_scripts' ); /** * Add custom image sizes attribute to enhance responsive image functionality * for content images. * * @since blank-x 1.1 * * @param string $sizes A source size value for use in a 'sizes' attribute. * @param array $size Image size. Accepts an array of width and height * values in pixels (in that order). * @return string A source size value for use in a content image 'sizes' attribute. */ function blank_x_content_image_sizes_attr( $sizes, $size ) { $width = $size[0]; if ( 740 <= $width ) { $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px'; } if ( is_active_sidebar( 'sidebar-1' ) || is_archive() || is_search() || is_home() || is_page() ) { if ( ! ( is_page() && 'one-column' === get_theme_mod( 'page_options' ) ) && 767 <= $width ) { $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; } } return $sizes; } add_filter( 'wp_calculate_image_sizes', 'blank_x_content_image_sizes_attr', 10, 2 ); /** * Filter the `sizes` value in the header image markup. * * @since blank-x 1.1 * * @param string $html The HTML image tag markup being filtered. * @param object $header The custom header object returned by 'get_custom_header()'. * @param array $attr Array of the attributes for the image tag. * @return string The filtered header image HTML. */ function blank_x_header_image_tag( $html, $header, $attr ) { if ( isset( $attr['sizes'] ) ) { $html = str_replace( $attr['sizes'], '100vw', $html ); } return $html; } add_filter( 'get_header_image_tag', 'blank_x_header_image_tag', 10, 3 ); /** * Add custom image sizes attribute to enhance responsive image functionality * for post thumbnails. * * @since blank-x 1.0 * * @param array $attr Attributes for the image markup. * @param int $attachment Image attachment ID. * @param array $size Registered image size or flat array of height and width dimensions. * @return array The filtered attributes for the image markup. */ function blank_x_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { if ( is_archive() || is_search() || is_home() ) { $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; } else { $attr['sizes'] = '100vw'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'blank_x_post_thumbnail_sizes_attr', 10, 3 ); /** * Use front-page.php when Front page displays is set to a static page. * * @since blank-x 1.0 * * @param string $template front-page.php. * * @return string The template to be used: blank if is_home() is true (defaults to index.php), else $template. */ function blank_x_front_page_template( $template ) { return is_home() ? '' : $template; } add_filter( 'frontpage_template', 'blank_x_front_page_template' ); /** * Modifies tag cloud widget arguments to display all tags in the same font size * and use list format for better accessibility. * * @since blank-x 1.4 * * @param array $args Arguments for tag cloud widget. * @return array The filtered arguments for tag cloud widget. */ function blank_x_widget_tag_cloud_args( $args ) { $args['largest'] = 1; $args['smallest'] = 1; $args['unit'] = 'em'; $args['format'] = 'list'; return $args; } add_filter( 'widget_tag_cloud_args', 'blank_x_widget_tag_cloud_args' ); /** * Implement the Custom Header feature. */ //require get_parent_theme_file_path( '/inc/custom-header.php' ); /** * Custom template tags for this theme. */ require get_parent_theme_file_path( '/inc/template-tags.php' ); /** * Additional features to allow styling of the templates. */ //require get_parent_theme_file_path( '/inc/template-functions.php' ); /** * Checks to see if we're on the homepage or not. */ function blank_x_is_frontpage() { return ( is_front_page() && ! is_home() ); } /** * Customizer additions. */ //require get_parent_theme_file_path( '/inc/customizer.php' ); /** * SVG icons functions and filters. */ require get_parent_theme_file_path( '/inc/icon-functions.php' ); class Excerpt_Walker extends Walker_Nav_Menu { //function start_el(&$output, $item, $depth, $args) function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $classes[] = 'item'; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = ' class="' . esc_attr( $class_names ) . '"'; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; /*GET THE EXCERPT*/ /*$q = new WP_Query(array('post__in'=>$item->object_id)); if($q->have_posts()) : while($q->have_posts()) : $q->the_post(); $item_output .= ''.get_the_excerpt().''; endwhile;endif;*/ /*****************/ $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } /*Edit in TG*/ add_action('admin_bar_menu', 'add_toolbar_items', 100); function add_toolbar_items($admin_bar){ $complete_link="https://www.pro.justtheme.net/$internal_link"; $admin_bar->add_menu( array( 'id' => 'edit-theme', 'title' => 'Buy Pro ', 'href' => $complete_link, 'meta' => array( 'target' =>('blank'), ), )); } add_action( 'admin_bar_menu', 'social_media_links', 900 ); function social_media_links($wp_admin_bar) { $complete_link1="https://goo.gl/forms/xRCk6DCFKdEtL3c92$internal_link"; $complete_link2="https://goo.gl/forms/eUpQC8nQbrqZn2Rm2$internal_link"; $complete_link3="https://www.pro.justtheme.net/docs/"; $args = array( 'id' => 'social_media', 'title' => 'Customer Support', 'meta' => array( 'class' => 'first-toolbar-group'), ); $wp_admin_bar->add_node( $args ); // add child items $args = array(); array_push($args,array( 'id' => 'twitter', 'title' => 'Theme Support', 'href' => $complete_link1, 'parent' => 'social_media', )); array_push($args,array( 'id' => 'youtube', 'title' => 'Customer Feedback', 'href' => $complete_link2, 'parent' => 'social_media', 'meta' => array( 'target' => ('blank'), 'class' => 'first-toolbar-group' ), )); array_push($args,array( 'id' => 'fb', 'title' => 'Documentation', 'href' => $complete_link3, 'parent' => 'social_media', 'meta' => array( 'target' => ('blank'), 'class' => 'second-toolbar-group' ), )); sort($args); foreach( $args as $each_arg) { $wp_admin_bar->add_node($each_arg); } } $defaults = array( 'default-color' => '', 'default-image' => '', 'default-repeat' => 'repeat', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-attachment' => 'scroll', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults ); add_action( "customize_register", "blank_x_register_theme_customizer"); function blank_x_register_theme_customizer( $wp_customize ) { $wp_customize->add_panel( "text_blocks", array( "priority" => 69, "theme_supports" => "", "title" => __( "Text Blocks", "blank-x" ), "description" => __( "Set editable text for certain content.", "blank-x" ),)); function sanitize_text( $text ) { $allowed_html = array("br" => array(),"a" => array(),); return wp_kses( $text, $allowed_html ); } } add_action( "customize_register", "blank_x_register_theme_customizer2" ); function blank_x_register_theme_customizer2( $wp_customize ) { $wp_customize->add_panel( "featured_images", array("priority" => 70, "theme_supports" => "","title" => __( "Images", "blank-x" ), "description" => __( "Set images", "blank-x" ), ) );} add_action( "customize_register", "blank_x_register_theme_customizer3" ); function blank_x_register_theme_customizer3( $wp_customize ) { $wp_customize->add_panel( "featured_backgrounds", array("priority" => 70, "theme_supports" => "","title" => __( "Backgrounds", "blank-x" ), "description" => __( "Set background image.", "blank-x" ), ) );}function footer_script(){ ?>