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-">
'post',
'post_status' => 'publish',
'posts_per_page'=> -1,
'post__in' => $slider_posts,
'orderby' => 'post__in'
) );
if( $qry->have_posts() ){?>
have_posts() ){
$qry->the_post();
$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'business-one-page-slider' );
?>
-
$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' );
if( $facebook || $twitter || $pinterest || $linkedin || $google_plus ){ ?>
';
if( $twitter ) echo ' ';
if( $pinterest ) echo ' ';
if( $linkedin ) echo ' ';
if( $google_plus ) echo ' ';
?>
';
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(){
$text = '';
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(){
$s = '';
$i = 1;
$cat = get_theme_mod( 'business_one_page_exclude_cat' );
if( $cat ){
$cat = array_diff( array_unique( $cat ), array('') );
foreach( $cat as $c ){
$i++;
$s .= '-'.$c;
if( count($cat) >= $i )
$s .= ', ';
}
}
$exclude = array( 'cat' => $s );
return $exclude;
}
add_filter( "widget_posts_args", "business_one_page_exclude_posts_from_recentPostWidget_by_cat" );