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 http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1200, 9999 ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => __( 'Primary Menu', 'blazeblog' ), 'social' => __( 'Social Links Menu', 'blazeblog' ), ) ); /* * 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', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 150, 'height' => 40, 'flex-width' => true, ) ); /* * Enable support for Post Formats. * * See: https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat', ) ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style( array( 'assets/css/editor-style.css', ggfx_fonts_url() ) ); } endif; // ggfx_setup add_action( 'after_setup_theme', 'ggfx_setup' ); /** * Sets 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 * * @since BlazeBlog 1.0 */ function ggfx_content_width() { $GLOBALS['content_width'] = apply_filters( 'ggfx_content_width', 840 ); } add_action( 'after_setup_theme', 'ggfx_content_width', 0 ); /** * Gets the custom logo img. * * @since BlazeBlog 1.0 */ function ggfx_get_custom_logo_img() { $custom_logo_id = get_theme_mod( 'custom_logo' ); $logo = ''; if($custom_logo_id) { $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $logo = sprintf('', $image[0], get_bloginfo( 'name', 'display' ), get_bloginfo( 'description', 'display' ) ); } echo $logo; } /** * Gets the icon logo. * * @since BlazeBlog 1.0 */ function ggfx_get_icon_logo() { $icon = ''; if(!get_theme_mod( 'custom_logo', false )) { if( get_theme_mod( 'ggfx_icon_logo', false ) ) { $icon = sprintf('', get_theme_mod( 'ggfx_icon_logo' )); } } echo $icon; } /** * Registers a widget area. * * @link https://developer.wordpress.org/reference/functions/register_sidebar/ * * @since BlazeBlog 1.0 */ function ggfx_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'blazeblog' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your sidebar.', 'blazeblog' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 1', 'blazeblog' ), 'id' => 'sidebar-2', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'blazeblog' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 2', 'blazeblog' ), 'id' => 'sidebar-3', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'blazeblog' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer', 'blazeblog' ), 'id' => 'sidebar-4', 'description' => __( 'Appears in the footer area of pages.', 'blazeblog' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ggfx_widgets_init' ); if ( ! function_exists( 'ggfx_fonts_url' ) ) : /** * Register Google fonts for BlazeBlog. * * Create your own ggfx_fonts_url() function to override in a child theme. * * @since BlazeBlog 1.0 * * @return string Google fonts URL for the theme. */ function ggfx_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; /* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Merriweather font: on or off', 'blazeblog' ) ) { $fonts[] = 'Merriweather:400,700,900,400italic,700italic,900italic'; } $fonts[] = 'Open Sans:400,700,900,400italic,700italic,900italic'; /* translators: If there are characters in your language that are not supported by Montserrat, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'blazeblog' ) ) { $fonts[] = 'Montserrat:400,700'; } /* translators: If there are characters in your language that are not supported by Inconsolata, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'blazeblog' ) ) { $fonts[] = 'Inconsolata:400'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), 'https://fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * Handles JavaScript detection. * * Adds a `js` class to the root `` element when JavaScript is detected. * * @since BlazeBlog 1.0 */ function ggfx_javascript_detection() { echo "\n"; } add_action( 'wp_head', 'ggfx_javascript_detection', 0 ); /** * Enqueues scripts and styles. * * @since BlazeBlog 1.0 */ function ggfx_scripts() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'ggfx-fonts', ggfx_fonts_url(), array(), null ); // Add Genericons, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/assets/genericons/genericons.css', array(), '3.4.1' ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), '3.3.6' ); if(is_rtl()){ wp_enqueue_style( 'bootstrap-rtl', get_template_directory_uri() . '/assets/css/rtl/bootstrap-rtl.min.css', array(), '3.3.6' ); } wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css', array(), '3.3.6' ); // Theme stylesheet. wp_enqueue_style( 'blaze-core-style', get_stylesheet_uri() ); wp_enqueue_style( 'blaze-style', get_template_directory_uri() . '/assets/css/style.css', array(), '1.0.0' ); if(is_rtl()){ wp_enqueue_style( 'bootstrap-rtl', get_template_directory_uri() . '/rtl.css', array(), '1.0.0' ); } // Load the html5 shiv. wp_enqueue_script( 'blaze-html5', get_template_directory_uri() . '/assets/js/html5.js', array(), '3.7.3' ); wp_script_add_data( 'blaze-html5', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery' ), '3.3.6', true ); wp_enqueue_script( 'blaze-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151112', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // Adds Masonry to handle vertical alignment of footer widgets. if ( is_active_sidebar( 'sidebar-4' ) ) wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'blaze-script', get_template_directory_uri() . '/assets/js/functions.js', array( 'jquery' ), '20151204', true ); wp_localize_script( 'blaze-script', 'screenReaderText', array( 'expand' => __( 'expand child menu', 'blazeblog' ), 'collapse' => __( 'collapse child menu', 'blazeblog' ), ) ); } add_action( 'wp_enqueue_scripts', 'ggfx_scripts' ); /** * Adds custom classes to the array of body classes. * * @since BlazeBlog 1.0 * * @param array $classes Classes for the body element. * @return array (Maybe) filtered body classes. */ function ggfx_body_classes( $classes ) { // Adds a class of custom-background-image to sites with a custom background image. if ( get_background_image() ) { $classes[] = 'custom-background-image'; } // Adds a class of group-blog to sites with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of no-sidebar to sites without active sidebar. if ( ! is_active_sidebar( 'sidebar-1' ) ) { $classes[] = 'no-sidebar'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } add_filter( 'body_class', 'ggfx_body_classes' ); /** * Converts a HEX value to RGB. * * @since BlazeBlog 1.0 * * @param string $color The original color, in 3- or 6-digit hexadecimal form. * @return array Array containing RGB (red, green, and blue) values for the given * HEX code, empty array otherwise. */ function ggfx_hex2rgb( $color ) { $color = trim( $color, '#' ); if ( strlen( $color ) === 3 ) { $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); } else if ( strlen( $color ) === 6 ) { $r = hexdec( substr( $color, 0, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) ); } else { return array(); } return array( 'red' => $r, 'green' => $g, 'blue' => $b ); } /** * Custom template tags for this theme. */ require_once( 'includes/theme-functions.php' ); /** * SASS compiler class */ require_once("includes/scssphp/wp.scss.inc.php"); /** * Customizer additions. */ require_once( 'includes/customizer.php' ); /** * Modifies tag cloud widget arguments to have all tags in the widget same font size. * * @since BlazeBlog 1.0 * * @param array $args Arguments for tag cloud widget. * @return array A new modified arguments. */ function ggfx_widget_tag_cloud_args( $args ) { $args['largest'] = 12; $args['smallest'] = 12; $args['unit'] = 'px'; return $args; } add_filter( 'widget_tag_cloud_args', 'ggfx_widget_tag_cloud_args' ); // get theme option value by option name if( !function_exists('ggfx_theme_option') ) { function ggfx_theme_option( $option_name ) { global $ggfx_options_var; $ggfx_options = get_option($ggfx_options_var); if ( isset( $ggfx_options[$option_name] ) ) return $ggfx_options[$option_name]; else return false; } } add_filter('embed_oembed_html', 'ggfx_embed_oembed_html', 99, 4); function ggfx_embed_oembed_html($html, $url, $attr, $post_id) { return '
' . $html . '
'; } add_filter( 'img_caption_shortcode', 'ggfx_img_caption_shortcode', 10, 3 ); function ggfx_img_caption_shortcode( $empty, $attr, $content ){ $attr = shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr ); if ( 1 > (int) $attr['width'] || empty( $attr['caption'] ) ) { return ''; } if ( $attr['id'] ) { $attr['id'] = 'id="' . esc_attr( $attr['id'] ) . '" '; } $output = '
'; $output .= do_shortcode( $content ); $output .= '

' . $attr['caption'] . '

'; $output .= '
'; return $output; }