ID, 'business_one_page_sidebar_layout', true ); if( $sidebar_layout == 'no-sidebar' ) $classes[] = 'full-width'; } return $classes; } add_filter( 'body_class', 'business_one_page_body_classes' ); /** * Callback function for Comment List * * * @link https://codex.wordpress.org/Function_Reference/wp_list_comments */ function business_one_page_theme_comment( $comment, $args, $depth ){ if ( 'div' == $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
%s', 'business-one-page' ), get_comment_author_link() ); ?>
comment_approved == '0' ) : ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
'post', 'post_status' => 'publish', 'posts_per_page'=> -1, 'post__in' => $slider_posts, 'orderby' => 'post__in', 'ignore_sticky_post' => true ) ); if( $qry->have_posts() ){?> $section, 'menu_text' => esc_attr( get_theme_mod( 'business_one_page_' . $section . '_section_menu_title','' ) ), ); } } return $enabled_section; } /** * Callback for Social Links */ function business_one_page_social_cb(){ $facebook = get_theme_mod( 'business_one_page_facebook' ); $twitter = get_theme_mod( 'business_one_page_twitter' ); $pinterest = get_theme_mod( 'business_one_page_pinterest' ); $linkedin = get_theme_mod( 'business_one_page_linkedin' ); $google_plus = get_theme_mod( 'business_one_page_google_plus' ); $instagram = get_theme_mod( 'business_one_page_instagram' ); $youtube = get_theme_mod( 'business_one_page_youtube' ); $ok = get_theme_mod( 'business_one_page_odnoklassniki' ); $vk = get_theme_mod( 'business_one_page_vk' ); $xing = get_theme_mod( 'business_one_page_xing' ); $tiktok = get_theme_mod( 'business_one_page_tiktok' ); if( $facebook || $twitter || $pinterest || $linkedin || $google_plus || $ok || $vk || $xing || $tiktok ){ ?> '; echo wp_strip_all_tags( $custom_css ); echo ''; } } add_action( 'wp_head', 'business_one_page_custom_css', 100 ); } if ( ! function_exists( 'business_one_page_excerpt_more' ) ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... * */ function business_one_page_excerpt_more( $more ) { return is_admin() ? $more : ' … '; } add_filter( 'excerpt_more', 'business_one_page_excerpt_more' ); endif; if ( ! function_exists( 'business_one_page_excerpt_length' ) ) : /** * Changes the default 55 character in excerpt */ function business_one_page_excerpt_length( $length ) { return is_admin() ? $length : 40; } add_filter( 'excerpt_length', 'business_one_page_excerpt_length' ); endif; /** * excerpt length for portfolio section */ function business_one_page_excerpt_length_alt( $length ){ return is_admin() ? $length : 12; } /** * Footer Credits */ function business_one_page_footer_credit(){ $copyright_text = get_theme_mod( 'business_one_page_footer_copyright_text' ); $text = ''; if( $copyright_text ){ $text .= wp_kses_post( $copyright_text ); }else{ $text .= esc_html__( 'Copyright © ', 'business-one-page' ) . date_i18n( esc_html__( 'Y', 'business-one-page' ) ); $text .= ' ' . esc_html( get_bloginfo( 'name' ) ) . '. '; } if ( function_exists( 'the_privacy_policy_link' ) ) { $text .= get_the_privacy_policy_link(); } $text .= esc_html__( ' Business One Page | Developed By ', 'business-one-page' ); $text .= 'Rara Theme'; $text .= sprintf( esc_html__( ' Powered by: %s', 'business-one-page' ), 'WordPress' ); echo apply_filters( 'business_one_page_footer_text', $text ); } add_action( 'business_one_page_footer', 'business_one_page_footer_credit' ); /** * Return sidebar layouts for pages */ function business_one_page_sidebar_layout(){ global $post; if( get_post_meta( $post->ID, 'business_one_page_sidebar_layout', true ) ){ return get_post_meta( $post->ID, 'business_one_page_sidebar_layout', true ); }else{ return 'right-sidebar'; } } /** * Exclude post with Category from blog and archive page. */ function business_one_page_exclude_cat( $query ){ $cat = get_theme_mod( 'business_one_page_exclude_cat' ); $show_on_front = get_option( 'show_on_front' ); $ed_slider = get_theme_mod( 'business_one_page_ed_slider' ); $slider_post1 = get_theme_mod( 'business_one_page_slider_post_one' ); $slider_post2 = get_theme_mod( 'business_one_page_slider_post_two' ); $slider_post3 = get_theme_mod( 'business_one_page_slider_post_three' ); $slider_post4 = get_theme_mod( 'business_one_page_slider_post_four' ); $sliders = array( $slider_post1, $slider_post2, $slider_post3, $slider_post4 ); $sliders = array_diff( array_unique( $sliders ), array('') ); if( ! is_admin() && $query->is_main_query() ){ if( $cat ){ $cat = array_diff( array_unique( $cat ), array('') ); if( $query->is_home() || $query->is_archive() ) { $query->set( 'category__not_in', $cat ); } } if( $sliders ){ if( $query->is_home() && $ed_slider && 'posts' == $show_on_front ){ $query->set( 'post__not_in', $sliders ); } } } } add_filter( 'pre_get_posts', 'business_one_page_exclude_cat' ); /** * Exclude Categories from Category Widget */ function business_one_page_custom_category_widget( $arg ) { $cat = get_theme_mod( 'business_one_page_exclude_cat' ); if( $cat ){ $cat = array_diff( array_unique( $cat ), array('') ); $arg["exclude"] = $cat; } return $arg; } add_filter( "widget_categories_args", "business_one_page_custom_category_widget" ); add_filter( "widget_categories_dropdown_args", "business_one_page_custom_category_widget" ); /** * Exclude post from recent post widget of excluded catergory * * @link http://blog.grokdd.com/exclude-recent-posts-by-category/ */ function business_one_page_exclude_posts_from_recentPostWidget_by_cat( $arg ){ $cat = get_theme_mod( 'business_one_page_exclude_cat' ); if( $cat ){ $cat = array_diff( array_unique( $cat ), array('') ); $arg["category__not_in"] = $cat; } return $arg; } add_filter( "widget_posts_args", "business_one_page_exclude_posts_from_recentPostWidget_by_cat" ); if( ! function_exists( 'business_one_page_escape_text_tags' ) ) : /** * Remove new line tags from string * * @param $text * * @return string */ function business_one_page_escape_text_tags( $text ) { return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) ); } endif; if( ! function_exists( 'business_one_page_change_comment_form_default_fields' ) ) : /** * Change Comment form default fields i.e. author, email & url. * https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/ */ function business_one_page_change_comment_form_default_fields( $fields ){ // get the current commenter if available $commenter = wp_get_current_commenter(); // core functionality $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $required = ( $req ? " required" : '' ); $author = ( $req ? __( 'Name*', 'business-one-page' ) : __( 'Name', 'business-one-page' ) ); $email = ( $req ? __( 'Email*', 'business-one-page' ) : __( 'Email', 'business-one-page' ) ); // Change just the author field $fields['author'] = '

'; $fields['email'] = '

'; $fields['url'] = '

'; return $fields; } endif; add_filter( 'comment_form_default_fields', 'business_one_page_change_comment_form_default_fields' ); if( ! function_exists( 'business_one_page_change_comment_form_defaults' ) ) : /** * Change Comment Form defaults * https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/ */ function business_one_page_change_comment_form_defaults( $defaults ){ $defaults['comment_field'] = '

'; return $defaults; } endif; add_filter( 'comment_form_defaults', 'business_one_page_change_comment_form_defaults' ); if( ! function_exists( 'wp_body_open' ) ) : /** * Fire the wp_body_open action. * Added for backwards compatibility to support pre 5.2.0 WordPress versions. */ function wp_body_open() { /** * Triggered after the opening tag. */ do_action( 'wp_body_open' ); } endif; if( ! function_exists( 'business_one_page_get_image_sizes' ) ) : /** * Get information about available image sizes */ function business_one_page_get_image_sizes( $size = '' ) { global $_wp_additional_image_sizes; $sizes = array(); $get_intermediate_image_sizes = get_intermediate_image_sizes(); // Create the full array with sizes and crop info foreach( $get_intermediate_image_sizes as $_size ) { if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' ); $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' ); $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' ); } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { $sizes[ $_size ] = array( 'width' => $_wp_additional_image_sizes[ $_size ]['width'], 'height' => $_wp_additional_image_sizes[ $_size ]['height'], 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'] ); } } // Get only 1 size if found if ( $size ) { if( isset( $sizes[ $size ] ) ) { return $sizes[ $size ]; } else { return false; } } return $sizes; } endif; if ( ! function_exists( 'business_one_page_get_fallback_svg' ) ) : /** * Get Fallback SVG */ function business_one_page_get_fallback_svg( $post_thumbnail ) { if( ! $post_thumbnail ){ return; } $image_size = business_one_page_get_image_sizes( $post_thumbnail ); if( $image_size ){ ?>
urlencode( implode( '|', $font_families ) ), 'display' => urlencode( 'fallback' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url( $fonts_url ); } endif; if( ! function_exists( 'business_one_page_load_preload_local_fonts') ) : /** * Get the file preloads. * * @param string $url The URL of the remote webfont. * @param string $format The font-format. If you need to support IE, change this to "woff". */ function business_one_page_load_preload_local_fonts( $url, $format = 'woff2' ) { // Check if cached font files data preset present or not. Basically avoiding 'business_one_page_WebFont_Loader' class rendering. $local_font_files = get_site_option( 'business_one_page_local_font_files', false ); if ( is_array( $local_font_files ) && ! empty( $local_font_files ) ) { $font_format = apply_filters( 'business_one_page_local_google_fonts_format', $format ); foreach ( $local_font_files as $key => $local_font ) { if ( $local_font ) { echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } return; } // Now preload font data after processing it, as we didn't get stored data. $font = business_one_page_webfont_loader_instance( $url ); $font->set_font_format( $format ); $font->preload_local_fonts(); } endif; if( ! function_exists( 'business_one_page_flush_local_google_fonts' ) ){ /** * Ajax Callback for flushing the local font */ function business_one_page_flush_local_google_fonts() { $WebFontLoader = new Business_One_Page_WebFont_Loader(); //deleting the fonts folder using ajax $WebFontLoader->delete_fonts_folder(); die(); } } add_action( 'wp_ajax_flush_local_google_fonts', 'business_one_page_flush_local_google_fonts' ); add_action( 'wp_ajax_nopriv_flush_local_google_fonts', 'business_one_page_flush_local_google_fonts' );