$font ): if ( $slug != 'system' && $slug != 'system-font-wordpress-default' ): $key = sanitize_title_with_dashes( $font['family'] ); $bx_font_simple_array[$key] = esc_html( $font['family'] ); $bx_font_array[$key]['family'] = esc_html( $font['family'] ); $bx_font_array[$key]['variants'] = $font['variants']; endif; endforeach; set_transient( 'bx_google_fonts', $bx_font_array, 86400 ); if ( $type == 'simple' ): return $bx_font_simple_array; else: return $bx_font_array; endif; endif; return $bx_font_array; } // get_header_image_tag callback function bx_get_header_image_tag( $html, $header, $attr ) { return '' . $attr['alt'] . ''; }; add_filter( 'get_header_image_tag', 'bx_get_header_image_tag', 10, 3 ); function bx_get_custom_logo( $html, $blog_id ){ $html = ''; $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) { switch_to_blog( $blog_id ); $switched_blog = true; } $custom_logo_id = get_theme_mod( 'custom_logo' ); // We have a logo. Logo is go. if ( $custom_logo_id ) { $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $logo_height = $logo[2] / 2; $logo_pos = $logo_height / 2; $html = sprintf( '', esc_url( home_url( '/' ) ), wp_get_attachment_image( $custom_logo_id, 'full', false, array( 'class' => 'custom-logo', 'itemprop' => 'logo', ) ) ); } // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). elseif ( is_customize_preview() ) { $html = ''; $html = sprintf( '

' . get_bloginfo('name') . '

', esc_url( home_url( '/' ) ) ); } if ( $switched_blog ) { restore_current_blog(); } return $html; } add_filter( 'get_custom_logo', 'bx_get_custom_logo', 10, 2 ); /** * Header Markup (to support WP 4.6 and lower) */ function bx_custom_header_markup(){ if ( get_header_image() ): $custom_markup = '
'; $custom_markup .= get_header_image_tag(); $custom_markup .= '
'; return $custom_markup; else: return false; endif; } /** * Theme Path DIR (_theme) */ function bx_theme_file_path( $file_path ){ if ( function_exists('get_theme_file_path') ): return get_theme_file_path( '_theme/' . $file_path ); else: return BX_THEME_DIR . $file_path; endif; } /** * Theme Path DIR (_theme) */ function bx_fw_file_path( $file_path ){ if ( function_exists('get_theme_file_path') ): return get_theme_file_path( '_framework/' . $file_path ); else: return BX_FW_DIR . $file_path; endif; } /** * Theme Path URL (_theme) */ function bx_theme_file_uri( $file_path ){ if ( function_exists('get_theme_file_uri') ): return get_theme_file_uri( '_theme/' . $file_path ); else: return BX_THEME_URL . $file_path; endif; } /** * Framework Path URL (_framework) */ function bx_fw_file_uri( $file_path ){ if ( function_exists('get_theme_file_uri') ): return get_theme_file_uri( '_framework/' . $file_path ); else: return BX_FW_URL . $file_path; endif; } /** * Social Icons */ function bx_social_icons() { global $bx_options; foreach ( $bx_options as $id => $value ): if ( $value && strpos($id, 'bx_socials') !== false ): $id = explode( '_', $id ); $id = $id[2]; echo ''; endif; endforeach; } /** * Add Item to Menu */ function bx_custom_nav_menu_item( $title, $url, $order = 0, $parent = 0, $classes = array() ){ $item = new stdClass(); $item->ID = 1000000 + $order + $parent; $item->db_id = $item->ID; $item->title = $title; $item->url = $url; $item->menu_order = $order; $item->menu_item_parent = $parent; $item->type = ''; $item->object = ''; $item->object_id = ''; $item->classes = $classes; $item->target = ''; $item->attr_title = ''; $item->description = ''; $item->xfn = ''; $item->status = ''; return $item; } /** * Post Thumbnail */ function bx_post_thumbnail( $thumb_name = false ){ $thumb_name = !$thumb_name ? 'post-thumbnail' : $thumb_name; if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } ob_start(); the_post_thumbnail( $thumb_name, array( 'title' => the_title_attribute( 'echo=0' ) ) ); return ob_get_clean(); } /** * Post Thumbnail URL */ function bx_post_thumbnail_url( $thumb_name = false ){ $thumb_name = !$thumb_name ? 'post-thumbnail' : $thumb_name; if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } $thumbnail_url = get_the_post_thumbnail_url( null, $thumb_name ); return $thumbnail_url; } /** * Breadcrumbs */ function bx_breadcrumbs() { // Get the query & post information global $post,$wp_query,$bx_options; if ( !empty($post) ): $bx_page_settings = get_post_meta( $post->ID, '_boxytheme_page_settings', true); else: $bx_page_settings = false; endif; $default_option = ( isset( $bx_options['boxytheme_breadcrumbs'] ) ? $bx_options['boxytheme_breadcrumbs'] : 'enabled' ); $crumbs_setting = ( isset( $bx_page_settings['breadcrumbs'] ) && $bx_page_settings['breadcrumbs'] ? $bx_page_settings['breadcrumbs'] : false ); if ( $crumbs_setting == 'enabled' || !$crumbs_setting && $default_option == 'enabled' ): // Settings $separator = ''; $breadcrums_id = 'bx-breadcrumbs'; $breadcrums_class = 'bx-breadcrumbs'; $home_title = esc_html_x('Home','Home Breadcrumb','boxy-studio'); // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat) $custom_taxonomy = 'product_cat'; // Build the breadcrums echo ''; endif; return false; } function bx_comments(){ if ( comments_open() || get_comments_number() ) { comments_template(); the_comments_pagination(); } }