'; echo ''; wp_list_pages( array( 'title_li' => '', 'depth' => 1, 'number' => 5, ) ); echo ''; } endif; //============================================================= // Function limit the number of words. //============================================================= function business_hub_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) { if(count($words) > $word_limit) { array_pop($words); return implode(' ', $words).'...'; } } else { return $string; } } //============================================================= // Function to change the number of words in excerpt. //============================================================= if ( ! function_exists( 'business_hub_excerpt_length' ) ) : function business_hub_excerpt_length( $length ) { $excerpt_length = business_hub_theme_options(); if ( empty( $excerpt_length['excerpt_length'] ) ) { $excerpt_length = $length; } return absint( $excerpt_length['excerpt_length'] ); } endif; add_filter( 'excerpt_length', 'business_hub_excerpt_length', 999 ); //============================================================= // To add class on body for sidebar //============================================================= if ( ! function_exists( 'business_hub_alter_body_class' ) ) { function business_hub_alter_body_class( $classes ) { $theme_options = business_hub_theme_options(); if( isset( $theme_options['sidebar'] ) && 'left' == $theme_options['sidebar'] ) { $sidebar_layout = 'left-sidebar'; }else { $sidebar_layout = 'right-sidebar'; } $classes[] = $sidebar_layout; return $classes; } } add_filter( 'body_class', 'business_hub_alter_body_class' ); //============================================================= // Function to check widget status //============================================================= if ( ! function_exists( 'business_hub_widget_count' ) ) : function business_hub_widget_count( $sidebar_names ){ $status = 0; foreach ($sidebar_names as $sidebar) { if( is_active_sidebar( $sidebar )){ $status = $status+1; } } return $status; } endif; //============================================================= // Function to use custom css //============================================================= if ( ! function_exists( 'business_hub_custom_css' ) ) { function business_hub_custom_css() { $theme_options = business_hub_theme_options(); if( !empty( $theme_options['custom_css']) ) { echo ''; } } } add_action( 'wp_head', 'business_hub_custom_css' );