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' ); /** * Hook to move comment text field to the bottom in WP 4.4 * * @link http://www.wpbeginner.com/wp-tutorials/how-to-move-comment-text-field-to-bottom-in-wordpress-4-4/ */ function business_one_page_move_comment_field_to_bottom( $fields ) { $comment_field = $fields['comment']; unset( $fields['comment'] ); $fields['comment'] = $comment_field; return $fields; } add_filter( 'comment_form_fields', 'business_one_page_move_comment_field_to_bottom' ); /** * Callback function for Comment List * * * @link https://codex.wordpress.org/Function_Reference/wp_list_comments */ function business_one_page_theme_comment( $comment, $args, $depth ){ $GLOBALS['comment'] = $comment; extract( $args, EXTR_SKIP ); 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' ); if( $facebook || $twitter || $pinterest || $linkedin || $google_plus || $ok || $vk || $xing ){ ?> '; 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' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... * */ function business_one_page_excerpt_more() { return ' … '; } 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 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 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('Y'); $text .= ' ' . esc_html( get_bloginfo( 'name' ) ) . '. '; } $text .= sprintf( esc_html__( ' %s', 'business-one-page' ), 'Business One Page by: 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' ); if( $cat && ! is_admin() && $query->is_main_query() ){ $cat = array_diff( array_unique( $cat ), array('') ); if( $query->is_home() || $query->is_archive() ) { $query->set( 'category__not_in', $cat ); } } } 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" ); /** * Query if Rara One Click Demo Import id activate */ function is_rocdi_activated(){ return class_exists( 'RDDI_init' ) ? true : false; } if( ! function_exists( 'business_one_page_single_post_schema' ) ) : /** * Single Post Schema * * @return string */ function business_one_page_single_post_schema() { if ( is_singular( 'post' ) ) { global $post; $custom_logo_id = get_theme_mod( 'custom_logo' ); $site_logo = wp_get_attachment_image_src( $custom_logo_id , 'business-one-page-schema' ); $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $excerpt = business_one_page_escape_text_tags( $post->post_excerpt ); $content = $excerpt === "" ? mb_substr( business_one_page_escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt; $schema_type = ! empty( $custom_logo_id ) && has_post_thumbnail( $post->ID ) ? "BlogPosting" : "Blog"; $args = array( "@context" => "http://schema.org", "@type" => $schema_type, "mainEntityOfPage" => array( "@type" => "WebPage", "@id" => get_permalink( $post->ID ) ), "headline" => ( function_exists( '_wp_render_title_tag' ) ? wp_get_document_title() : wp_title( '', false, 'right' ) ), "image" => array( "@type" => "ImageObject", "url" => $images[0], "width" => $images[1], "height" => $images[2] ), "datePublished" => get_the_time( DATE_ISO8601, $post->ID ), "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ), "author" => array( "@type" => "Person", "name" => business_one_page_escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) ) ), "publisher" => array( "@type" => "Organization", "name" => get_bloginfo( 'name' ), "description" => get_bloginfo( 'description' ), "logo" => array( "@type" => "ImageObject", "url" => $site_logo[0], "width" => $site_logo[1], "height" => $site_logo[2] ) ), "description" => ( class_exists('WPSEO_Meta') ? WPSEO_Meta::get_value( 'metadesc' ) : $content ) ); if ( has_post_thumbnail( $post->ID ) ) : $args['image'] = array( "@type" => "ImageObject", "url" => $images[0], "width" => $images[1], "height" => $images[2] ); endif; if ( ! empty( $custom_logo_id ) ) : $args['publisher'] = array( "@type" => "Organization", "name" => get_bloginfo( 'name' ), "description" => get_bloginfo( 'description' ), "logo" => array( "@type" => "ImageObject", "url" => $site_logo[0], "width" => $site_logo[1], "height" => $site_logo[2] ) ); endif; echo '' , PHP_EOL; } } endif; add_action( 'wp_head', 'business_one_page_single_post_schema' ); 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;