urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'cyrillic,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
}
// Display the logo
if ( ! function_exists( 'bento_logo' ) ) {
function bento_logo() {
if ( get_theme_mod( 'custom_logo' ) != '' ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo_image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
$logo_full = $logo_mobile = $logo_image[0];
if ( get_theme_mod( 'bento_logo_mobile' ) != '' ) {
$mobile_logo_id = get_theme_mod( 'bento_logo_mobile' );
$mobile_logo_image = wp_get_attachment_image_src( $mobile_logo_id , 'full' );
$logo_mobile = $mobile_logo_image[0];
}
echo '
'.$post_date_link.'
'.$post_day.'
'.$post_month.'
'.$post_year.'
'.$post_date_link_close.'
';
}
}
// Display post title
if ( ! function_exists( 'bento_post_title' ) ) {
function bento_post_title() {
global $post;
// Check for formats which do not imply a title
if ( in_array( get_post_format(), array('link','aside','status','quote'), true ) ) {
return;
}
// If project post type and has a sidebar, exit
if ( get_post_type() == 'project' && get_post_meta( $post->ID, 'bento_sidebar_layout', true ) != 'full-width' ) {
return;
}
echo '';
}
}
// Display post content according to the post format
if ( ! function_exists( 'bento_post_content' ) ) {
function bento_post_content() {
global $post;
// If project post type and has a sidebar, exit
if ( get_post_type() == 'project' && get_post_meta( $post->ID, 'bento_sidebar_layout', true ) != 'full-width' ) {
return;
}
echo '';
// Check for post format and display respective content
if ( get_post_format() === 'link' ) {
echo bento_link_format_content();
} elseif ( get_post_format() === 'quote' ) {
echo bento_quote_format_content();
} else {
the_content( esc_html__( 'Continue reading', 'bento' ).' →' );
}
// Navigation for paged posts
wp_link_pages(
array(
'before' => '
',
'after' => '
',
'link_before' => '
',
'link_after' => '',
)
);
echo '
';
}
}
// Display entry meta
if ( ! function_exists( 'bento_entry_meta' ) ) {
function bento_entry_meta() {
echo '';
return;
}
// If project, display navigation
if ( get_post_type() == 'project' && is_singular('project') ) {
if ( function_exists( 'bento_ep_project_nav' ) ) {
bento_ep_project_nav();
}
return;
}
// Display a pin for sticky posts
if ( is_sticky() && is_home() && ! is_paged() ) {
echo ' id="comment-">
comment_approved == '0' ) { ?>
'← '.esc_html__( 'Previous page', 'bento' ),
'next_text' => esc_html__( 'Next page', 'bento' ).' →',
)
);
}
}
// Display a pager for grid pages
if ( ! function_exists( 'bento_grid_pagination' ) ) {
function bento_grid_pagination() {
global $bento_query;
?>
array(
'href' => array(),
'title' => array(),
'target' => array()
)
)
);
$anchor = get_the_title();
if ( ! filter_var( $url, FILTER_VALIDATE_URL ) === false ) {
return '
'.esc_html( $anchor ).'';
} else {
return $url;
}
}
}
// Display content for the "quote" post type
if ( ! function_exists( 'bento_quote_format_content' ) ) {
function bento_quote_format_content() {
$quote = esc_html( get_the_content() );
$author = esc_html( get_the_title() );
$output = '
'.$quote.'
';
if ( $author != '' ) {
$output .= '
'.$author.'
';
}
return $output;
}
}
// Display the copyright in the footer
if ( ! function_exists( 'bento_copyright' ) ) {
function bento_copyright() {
$author = 'Bento WordPress '.esc_html__( 'Theme', 'bento' );
if ( is_front_page() ) {
$author = '
Bento WordPress '.esc_html__( 'Theme', 'bento' );
}
$copyright = '';
echo wp_kses( $copyright,
array(
'a' => array(
'target' => array(),
'href' => array(),
'title' => array(),
),
'div' => array(
'class' => array(),
),
'span' => array(),
)
);
}
}
// Display the button for the ajax loader
if ( ! function_exists( 'bento_ajax_load_more' ) ) {
function bento_ajax_load_more() {
if ( is_home() || is_archive() || is_search() ) {
$class = '';
} else {
$class = 'grid-ajax-load-more';
}
?>
', ']]>', $content );
// First check if the post has an excerpt
if ( has_excerpt() ) {
$excerpt = esc_html( get_the_excerpt() );
} else {
$content_main = $content['main'];
if ( strlen($content_main) > $length ) {
$pos = strpos( $content_main, ' ', $length );
if ( $pos === false ) {
$excerpt = $content_main;
} else {
$excerpt = substr( $content_main, 0, $pos );
$excerpt .= '..
→';
}
} else {
$excerpt = $content_main;
}
}
if ( get_post_format() === 'link' ) {
$excerpt = bento_link_format_content();
} elseif ( get_post_format() === 'quote' ) {
$excerpt = bento_quote_format_content();
}
echo '
'.$excerpt.'
';
}
}
// Render masonry tile content
if ( ! function_exists( 'bento_masonry_item_content' ) ) {
function bento_masonry_item_content() {
global $post;
global $bento_parent_page_id;
$tile_content = $tile_title = $tile_content_opacity = $tile_text_style = $tile_project_types = $tile_text_color = $tile_background = $tile_image = $tile_overlay = $tile_color = $tile_opacity = '';
// Content
if ( get_post_format( $post->ID ) === 'quote' ) {
$tile_title = '"'.esc_html( get_the_content() ).'"
'.esc_html( get_the_title() ).'';
} else {
$tile_title = esc_html( get_the_title() );
}
if ( get_post_meta( $bento_parent_page_id, 'bento_hide_tile_overlays', true) == 'on' ) {
$tile_content_opacity = 'style="opacity: 0.0"';
}
$tile_types = get_post_meta( $bento_parent_page_id, 'bento_page_content_types', true );
if ( is_array( $tile_types ) ) {
if ( implode( $tile_types ) == 'project' ) {
$types_objects = get_the_terms( $post->ID, 'project_type' );
$tile_project_types_list = array();
if ( $types_objects != false ) {
foreach ( $types_objects as $types_object ) {
$tile_project_types_list[] = esc_html( $types_object->name );
}
$tile_project_types_list = implode(', ', $tile_project_types_list);
$tile_project_types = '
'.$tile_project_types_list.'
';
}
}
}
$tile_text_color = 'color:'.esc_html( get_post_meta( $post->ID, 'bento_tile_text_color', true ) ).';';
$tile_text_size = 'font-size:'.esc_html( get_post_meta( $post->ID, 'bento_tile_text_size', true ) ).'px;';
$tile_text_style .= 'style="'.$tile_text_color.$tile_text_size.'"';
$tile_content .= '
'.$tile_project_types.'
';
// Background
if ( get_post_meta( $post->ID, 'bento_tile_image', true ) != '' ) {
$tile_image = esc_url( get_post_meta( $post->ID, 'bento_tile_image', true ) );
} else if ( has_post_thumbnail() ) {
$post_thumb = esc_url( wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ) );
$tile_image = $post_thumb[0];
}
$tile_background .= 'style=background-image:url("'.$tile_image.'")';
if ( get_post_meta( $post->ID, 'bento_tile_overlay_opacity', true) != '' ) {
if ( get_post_meta( $bento_parent_page_id, 'bento_hide_tile_overlays', true) != 'on' ) {
$tile_opacity = 'opacity:'.esc_html( get_post_meta( $post->ID, 'bento_tile_overlay_opacity', true) ).';';
} else {
$tile_opacity = 'opacity: 0.0';
}
}
if ( get_post_meta( $post->ID, 'bento_tile_overlay_color', true ) != '' ) {
$tile_color = 'background-color:'.esc_html( get_post_meta( $post->ID, 'bento_tile_overlay_color', true ) ).';';
}
$tile_overlay .= 'style="'.$tile_color.$tile_opacity.'"';
$tile_content .= '
';
echo $tile_content;
}
}
// Display info header for new users
if ( ! function_exists( 'bento_novice_header' ) ) {
function bento_novice_header() {
$status = get_option( 'novice_header' );
if ( $status != 'dismissed' ) {
?>