';
comments_popup_link(
' '.esc_html__( 'Leave a comment', 'business-power' ),
' '.esc_html__( '1 response', 'business-power' ),
' % '. esc_html__( 'responses' , 'business-power' )
);
echo '';
}
}
/**
* Creats slug of the text
*
* @static
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function uglify( $text, $condition = array() ){
$defaults = array(
'lowercase' => true,
'separator' => '-',
);
# Parse incoming $args into an array and merge it with $defaults
$args = wp_parse_args( $condition, $defaults );
$text = str_replace ( ' ', $args[ 'separator' ] , $text );
if( $args[ 'lowercase' ] ){
$text = strtolower( $text );
}
return $text;
}
/**
* The post Navigation
*
* @static
* @access public
* @return object
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function posts_navigation( $echo = true ) {
$infinity_module_active = false;
if( get_option( 'jetpack_active_modules' ) ){
if( in_array( 'infinite-scroll', get_option( 'jetpack_active_modules' ) ) ){
$infinity_module_active = true;
}
}
# Previous/next page navigation.
if( !$infinity_module_active || !Business_Power_Helper::is_active_plugin( 'jetpack' ) ){
the_posts_pagination(
array(
'mid_size' => 2,
'prev_text' => esc_html__( 'Previous', 'business-power' ),
'next_text' => esc_html__( 'Next', 'business-power' ),
)
);
}
}
/**
* Pagination for the content seperated by page break.
*
* @static
* @access public
* @return object
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function post_content_navigation(){
wp_link_pages( array(
'before' => '' . esc_html__( 'Pages:', 'business-power' ),
'after' => '
',
'link_before' => '',
'link_after' => ''
) );
}
/**
* Pagination for single post in single page
*
* @static
* @access public
* @return object
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function single_post_navigation(){
the_post_navigation( array(
'prev_text' => '' . esc_html__( 'Previous Post', 'business-power' ) . '%title',
'next_text' => '' . esc_html__( 'Next Post', 'business-power' ) . '%title',
));
}
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* @static
* @access public
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function post_thumbnail( $size = 'post-thumbnail' ) {
if ( has_post_thumbnail() ) { ?>
',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( get_avatar_url( $author_id, array( 'size'=> 40 ) ) )
);
}
}
/**
* Prints HTML with meta information about theme author.
*
* @static
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function posted_by(){
if( apply_filters( 'business_power_show_post_author', true ) ):
printf(
/* translators:1-author link, 2-author image link,
* 3- author text, 4- author name.
*/
'
%2$s
%3$s
',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html__( 'By ', 'business-power' ),
esc_html( get_the_author() )
);
endif;
}
/**
* Prints HTML with meta information for the current post-date/time.
*
* @static
* @access public
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function the_date( $status = 'posted' ) {
$show = apply_filters( 'business_power_show_post_date', true );
if( $show ):
$time_string = '';
if( $status == 'updated'){
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
}
$time_tag = sprintf(
$time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date( get_option('date_format') ) ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
printf(
'
%2$s
%3$s
',
esc_url( self::get_day_link() ),
( 'posted' == $status ) ? esc_html__( 'On', 'business-power' ) : esc_html__( 'Updated on', 'business-power' ),
$time_tag
);
endif;
}
/**
* Prints the category of the posts
*
* @static
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function the_category(){
$show = apply_filters( 'business_power_show_post_category', true );
if( $show ){
the_category();
}
}
/**
* edit link on post if user is logged in
*
* @return void
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function edit_link(){
edit_post_link(
sprintf(
'%1$s%2$s',
esc_html__( 'Edit', 'business-power' ),
get_the_title()
),
'',
''
);
}
/**
* Displays the theme tags
*
* @static
* @access public
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function display_tag_list(){
$tags_list = get_the_tag_list( '', ', ' );
if ( $tags_list ) {
printf(
/* translators: 1: posted in label, only visible to screen readers. 2: list of tags. */
'%2$s %3$s',
esc_html__( 'Tags:', 'business-power' ),
esc_html( $tags_list )
); // WPCS: XSS OK.
}
}
/**
* Replace dash by space
*
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function beautify( $string ){
return ucwords( str_replace( '-', ' ', $string ) );
}
/**
* Check the plugin is active or not
*
* @static
* @access public
* @return boolean
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function is_active_plugin( $plugin_name ){
switch( $plugin_name ){
case 'woocommerce':
return class_exists( 'WooCommerce' );
break;
case 'yoast':
return class_exists( 'WPSEO_Primary_Term' );
break;
case 'jetpack':
return class_exists( 'Jetpack' );
break;
}
return false;
}
/**
* Get body font family.
*
* @static
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function get_font( $value ){
$fonts = self::get_font_family();
return $fonts[ $value ];
}
/**
* Font family
*
* @static
* @access public
* @return object
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function get_font_family( ){
return apply_filters( 'business_power_standard_fonts_array', array(
'font-1' => esc_html__( 'Lato', 'business-power' ),
'font-2' => esc_html__( 'Oswald', 'business-power' ),
'font-3' => esc_html__( 'Montserrat', 'business-power' ),
'font-4' => esc_html__( 'Roboto', 'business-power' ),
'font-5' => esc_html__( 'Raleway', 'business-power' ),
'font-6' => esc_html__( 'Playfair Display', 'business-power' ),
'font-7' => esc_html__( 'Fjalla One', 'business-power' ),
'font-8' => esc_html__( 'Alegreya Sans', 'business-power' ),
'font-9' => esc_html__( 'PT Sans Narrow', 'business-power' ),
'font-10' => esc_html__( 'Open Sans', 'business-power' ),
'font-11' => esc_html__( 'Poppins', 'business-power' ),
'font-12' => esc_html__( 'Hind', 'business-power' ),
'font-13' => esc_html__( 'Quicksand', 'business-power' ),
));
}
/**
* Google font url
*
* @static
* @access public
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function get_google_font(){
$google_fonts = array();
$condition = array(
'lowercase' => false,
'separator' => '+',
);
$google_fonts[] = self::uglify( self::get_font( business_power_get( 'body-font' ) ), $condition );
$google_fonts[] = self::uglify( self::get_font( business_power_get( 'heading-font' ) ), $condition );
$google_fonts[] = self::uglify( self::get_font( business_power_get( 'site-info-font' ) ), $condition );
$fonts = array_unique( $google_fonts );
$fonts_weight = apply_filters( 'business_power_standard_fonts_weight', array(
'Montserrat' => array( '100', '200', '300' ),
'Lato' => array( '100', '200', '300', '500' ),
'Open+Sans' => array( '100', '200', '300', '400' ),
'Poppins' => array( '400', '500', '600', '700', '800' ),
'Hind' => array( '400', '500', '600', '700', '800' ),
'Quicksand' => array( '400', '500', '600', '700', '800' )
));
foreach ( $fonts as $value ) {
if( isset( $fonts_weight[ $value ] ) ){
$font_wt[] = $value.':'.implode( ',', $fonts_weight[ $value ] );
}else{
$font_wt[] = $value;
}
}
if( $font_wt ){
$fonts_url = add_query_arg(
array(
'family' => implode( '|', $font_wt ),
), '//fonts.googleapis.com/css'
);
}
return $fonts_url;
}
/**
* Get the title
*
* @return string
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function get_title( $link = true ){ ?>
0 && $cls[ 0 ] !== 'business-power-no-sidebar' ? true : false;
}
/**
* Adds sidebar in pages
*
* @static
* @access public
* @since 1.0
*
* @package Business Power WordPress Theme
*/
public static function the_sidebar(){
if( self::is_sidebar_active() ): ?>