urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
/**
* Get theme option
*
* @since 1.0.0
*
* @return string
*/
public static function get_option( $name ) {
return Theme::instance()->get( 'options' )->get_option( $name );
}
/**
* Get post found
*
* @since 1.0.0
*
* @return void
*/
public static function posts_found() {
global $wp_query;
if ( $wp_query && isset( $wp_query->found_posts ) ) {
$post_text = $wp_query->found_posts > 1 ? esc_html__( 'posts', 'razzi' ) : esc_html__( 'post', 'razzi' );
if ( \Razzi\Helper::is_catalog() ) {
$post_text = $wp_query->found_posts > 1 ? esc_html__( 'products', 'razzi' ) : esc_html__( 'product', 'razzi' );
}
echo sprintf( '
',
esc_html__( 'Showing', 'razzi' ), $wp_query->post_count, esc_html__( 'of', 'razzi' ), $wp_query->found_posts, $post_text );
}
}
/**
* Post pagination
*
* @since 1.0.0
*
* @return void
*/
public function load_pagination() {
global $wp_query;
if ( $wp_query->max_num_pages < 2 ) {
return;
}
$more_text = ! empty( Helper::get_option( 'blog_view_more_text' ) ) ? Helper::get_option( 'blog_view_more_text' ) : esc_html__('Load More', 'razzi');
$nav_html = sprintf( '%s ', esc_html( $more_text ) );
?>
isMobile() && ! $detect->isTablet() ) {
return true;
}
return false;
}
/**
* Print HTML of currency switcher
* It requires plugin WooCommerce Currency Switcher installed
*
* @since 1.0.0
*
* @return void
*/
public static function currency_switcher( $args = array() ) {
$currencies_code = Helper::get_option('header_currency_code');
if( $currencies_code ) {
echo do_shortcode( wp_kses_post( $currencies_code ) );
return;
}
global $WOOCS;
$currencies = class_exists( 'WOOCS' ) ? $WOOCS->get_currencies() : array();
$currencies = apply_filters( 'woocs_active_currencies', $currencies );
$current_currency = class_exists( 'WOOCS' ) ? $WOOCS->current_currency : '';
$current_currency = apply_filters( 'woocs_current_currencies', $current_currency );
$args = wp_parse_args( $args, array( 'label' => '', 'direction' => 'down' ) );
$currency_list = array();
if( empty($currencies) ) {
return;
}
foreach ( $currencies as $key => $currency ) {
if ( $current_currency == $key ) {
array_unshift( $currency_list, sprintf(
'%s ',
esc_attr( $currency['name'] ),
esc_html( $currency['name'] )
) );
} else {
$currency_list[] = sprintf(
'%s ',
esc_attr( $currency['name'] ),
esc_html( $currency['name'] )
);
}
}
?>
'', 'direction' => 'down' ) );
$lang_list = array();
$current = '';
foreach ( (array) $languages as $code => $language ) {
if ( ! $language['active'] ) {
$lang_list[] = sprintf(
'%s ',
esc_attr( $code ),
esc_url( $language['url'] ),
esc_html( $language['native_name'] )
);
} else {
$current = $language;
array_unshift( $lang_list, sprintf(
'%s ',
esc_attr( $code ),
esc_url( $language['url'] ),
esc_html( $language['native_name'] )
) );
}
}
?>
'socials',
'container_class' => 'socials-menu ',
'menu_id' => 'socials-menu',
'depth' => 1,
'link_before' => '',
'link_after' => ' ',
'walker' => new \Razzi\Addons\Modules\Mega_Menu\Socials_Walker()
) ) );
} else {
wp_nav_menu( apply_filters( 'razzi_navigation_social_content', array(
'theme_location' => 'socials',
'container_class' => 'socials-menu ',
'menu_id' => 'socials-menu',
'depth' => 1,
'link_before' => '',
'link_after' => ' ',
) ) );
}
}
}
/**
* Get Header Layout
*
* @since 1.0.0
*
* @return string
*/
public static function get_header_layout() {
if( isset( self::$header_layout ) ) {
return self::$header_layout;
}
$custom_header_layout = get_post_meta( Helper::get_post_ID(), 'rz_header_layout', true );
if( ! empty($custom_header_layout) && 'default' != $custom_header_layout ) {
self::$header_layout = $custom_header_layout;
} elseif(Helper::get_option('header_type') == 'default') {
self::$header_layout = Helper::get_option( 'header_layout' );
}
return self::$header_layout;
}
/**
* Get Post ID
*
* @since 1.0.0
*
* @return string
*/
public static function get_post_ID() {
if( isset( self::$post_id ) ) {
return self::$post_id;
}
if ( \Razzi\Helper::is_catalog() ) {
self::$post_id = intval( get_option( 'woocommerce_shop_page_id' ) );
} elseif ( \Razzi\Helper::is_blog() ) {
self::$post_id = intval( get_option( 'page_for_posts' ) );
} else {
self::$post_id = get_the_ID();
}
return self::$post_id;
}
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* @since 1.0.0
*
* @return void
*/
public static function post_thumbnail( $size = 'full' ) {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
$post_thumbnail_id = get_post_thumbnail_id( get_the_ID() );
if ( is_singular() ) :?>
' . esc_html( get_the_date( "d" ) ) . '';
$month = '' . esc_html( get_the_date( "M" ) ) . ' ';
echo sprintf( '%s %s
', $month, $day );
}
/**
* Prints HTML with meta information for the categories, tags and comments.
*
* @since 1.0.0
*
* @return void
*/
public static function post_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'razzi' ) );
if ( $categories_list ) {
/* translators: 1: list of categories. */
printf( '' . esc_html__( 'Posted in %1$s', 'razzi' ) . ' ', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'razzi' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '' . esc_html__( 'Tagged %1$s', 'razzi' ) . ' ', $tags_list ); // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
}
}