'fas fa-thumbtack', 'sticky' => 'fas fa-thumbtack', 'aside' => 'fas fa-file-alt', 'image' => 'fas fa-image', 'video' => 'far fa-play-circle', 'quote' => 'fas fa-quote-right', 'link' => 'fas fa-link', 'gallery' => 'fas fa-images', 'status' => 'fas fa-comment', 'audio' => 'fas fa-volume-up', 'chat' => 'fas fa-comments', ); $format = get_post_format(); if( empty( $format ) ){ $format = 'standard'; } return apply_filters( 'bosa_post_format_icon', $icons[ $format ] ); } endif; /** * Page/Post title in frontpage and blog */ function bosa_page_title_display() { if ( is_singular() || ( !is_home() && is_front_page() ) ): ?>
', '' ); elseif ( is_search() ) : ?> ' . esc_html__( 'Oops! That page can't be found.', 'bosa' ) . ''; endif; } /** * Display page title */ function bosa_page_title() { if( get_theme_mod( 'disable_page_title', 'disable_front_page' ) == 'disable_all_pages' ){ // this condition will disable page title from all pages echo ''; }elseif( is_front_page() && get_theme_mod( 'disable_page_title', 'disable_front_page' ) == 'disable_front_page' ){ // this condition will disable page title from front page only echo ''; }else { bosa_page_title_display(); } } /** * Display single post title */ function bosa_single_page_title() { if( get_theme_mod( 'disable_single_post_title', 'enable_all_pages' ) == 'disable_all_pages' ){ // this condition will disable page title from all pages echo ''; }else { bosa_page_title_display(); } } /** * Display blog page title */ function bosa_blog_page_title() { if( get_theme_mod( 'disable_blog_page_title', 'enable_all_pages' ) == 'disable_all_pages' ){ // this condition will disable page title from all pages echo ''; }else { bosa_page_title_display(); } } /** * Adds custom size in images */ function bosa_image_size( $image_size ){ $image_id = get_post_thumbnail_id(); the_post_thumbnail( $image_size, array( 'alt' => esc_attr(get_post_meta( $image_id, '_wp_attachment_image_alt', true)) ) ); } /** * Adds a submit button in search form * * @since Bosa 1.0.0 * @param string $form * @return string */ function bosa_modify_search_form( $form ){ return str_replace( '', '', $form ); } add_filter( 'get_search_form', 'bosa_modify_search_form' ); /** * Add breadcrumb */ if ( ! function_exists( 'bosa_breadcrumb' ) ) : function bosa_breadcrumb() { // Bail if Home Page. if ( ! is_home() && is_front_page() ) { return; } ?> ', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'bosa_pingback_header' ); /** * Add a class in body * * @since Bosa 1.0.0 * @param array $class * @return array $class */ function bosa_body_class_modification( $class ){ // Site Dark Mode if( !get_theme_mod( 'disable_dark_mode', true ) ){ $class[] = 'dark-mode'; } // Site Layouts if( get_theme_mod( 'site_layout', 'default' ) == 'default' ){ $class[] = 'site-layout-default'; }else if( get_theme_mod( 'site_layout', 'default' ) == 'box' ){ $class[] = 'site-layout-box'; }else if( get_theme_mod( 'site_layout', 'default' ) == 'frame' ){ $class[] = 'site-layout-frame'; }else if( get_theme_mod( 'site_layout', 'default' ) == 'full' ){ $class[] = 'site-layout-full'; }else if( get_theme_mod( 'site_layout', 'default' ) == 'extend' ){ $class[] = 'site-layout-extend'; } return $class; } add_filter( 'body_class', 'bosa_body_class_modification' ); if( !function_exists( 'bosa_transparent_body_class' ) ){ /** * Add trasparent-header class in body * * @since Bosa 1.2.4 * @param array $class * @return array $class */ function bosa_transparent_body_class( $class ){ if( get_theme_mod( 'header_layout', 'header_one' ) == 'header_two' ){ if( ( !get_theme_mod( 'disable_transparent_header_page', true ) && is_page() ) || ( !get_theme_mod( 'disable_transparent_header_post', true ) && is_single() ) || is_front_page() ){ $class[] = 'transparent-header'; } } return $class; } add_filter( 'body_class', 'bosa_transparent_body_class' ); } /** * 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 bosa_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( 'bosa_content_width', 720 ); } add_action( 'after_setup_theme', 'bosa_content_width', 0 ); /** * Get Related Posts * * @since Bosa 1.0.0 * @param array $taxonomy * @param int $per_page Default 3 * @return bool | object */ if( !function_exists( 'bosa_get_related_posts' ) ): function bosa_get_related_posts( $taxonomy = array(), $per_page = 4, $get_params = false ){ # Show related posts only in single page. if ( !is_single() ) return false; # Get the current post object to start of $current_post = get_queried_object(); # Get the post terms, just the ids $terms = wp_get_post_terms( $current_post->ID, $taxonomy, array( 'fields' => 'ids' ) ); # Lets only continue if we actually have post terms and if we don't have an WP_Error object. If not, return false if ( !$terms || is_wp_error( $terms ) ) return false; # Check if the users argument is valid if( is_array( $taxonomy ) && count( $taxonomy ) > 0 ){ $tax_query_arg = array(); foreach( $taxonomy as $tax ){ $tax = filter_var( $tax, FILTER_SANITIZE_STRING ); if ( taxonomy_exists( $tax ) ){ array_push( $tax_query_arg, array( 'taxonomy' => $tax, 'terms' => $terms, 'include_children' => false ) ); } } if( count( $tax_query_arg ) == 0 ){ return false; } if( count( $tax_query_arg ) > 1 ){ $tax_query_arg[ 'relation' ] = 'OR'; } }else return false; # Set the default query arguments $args = array( 'post_type' => $current_post->post_type, 'post__not_in' => array( $current_post->ID ), 'posts_per_page' => $per_page, 'tax_query' => $tax_query_arg, ); if( $get_params ){ return $args; } # Now we can query our related posts and return them $q = get_posts( $args ); return $q; } endif; /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar * @since Bosa 1.0.0 */ function bosa_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Right Sidebar', 'bosa' ), 'id' => 'right-sidebar', 'description' => esc_html__( 'Add widgets here.', 'bosa' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Offcanvas Menu Sidebar', 'bosa' ), 'id' => 'menu-sidebar', 'description' => esc_html__( 'Add widgets here.', 'bosa' ), 'before_widget' => ' ', 'before_title' => '