ID, 'blogmarks_page_layout', true ); if ( empty( $page_layout ) && is_single() ) { $page_layout = blogmarks_get_option( 'single_post_layout', 'right-sidebar' ); } } // Woocommerce. if ( blogmarks_is_wc_active() ) : if ( is_shop() || is_product_category() ) : $page_layout = blogmarks_get_option( 'shop_page_layout', 'right-sidebar' ); endif; if ( is_product() ) : $page_layout = blogmarks_get_option( 'product_page_layout', 'right-sidebar' ); endif; endif; // Fetch from customizer if everything else fails. if ( empty( $page_layout ) ) { $page_layout = blogmarks_get_option( 'global_layout', 'right-sidebar' ); } return $page_layout; } endif; if ( ! function_exists( 'blogmarks_get_sidebar' ) ) : /** * Get Proper sidebar based on settings * * @since 1.0.0 * * @return string Sidebar */ function blogmarks_get_sidebar() { $sidebar_style = blogmarks_get_sidebar_widget_style(); $heading_style = blogmarks_get_sidebar_heading_style(); $heading_align = blogmarks_get_sidebar_heading_align(); $class = $sidebar_style; $class .= ' ' . $heading_style; $class .= ' ' . $heading_align; if ( is_front_page() ) : $hide_sidebar_mobile = blogmarks_get_option( 'hide_front_page_sidebar_mobile' ); $class .= $hide_sidebar_mobile ? ' hide-on-mobile ' : ''; if ( blogmarks_get_option( 'front_page_enable_sidebar' ) ) : if ( is_active_sidebar( 'home-page-sidebar' ) ) : ?> $width, 'height' => $height, 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'], ); } } } if ( true == $for_choice ) { $sizes['full'] = __( 'Full Image', 'blogmarks' ); } return $sizes; } endif; if ( ! function_exists( 'blogmarks_get_header_layouts' ) ) : /** * Returns header layout options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_header_layouts() { $options = apply_filters( 'blogmarks_header_layouts', array( 'header_style_1' => array( 'url' => get_template_directory_uri() . '/assets/images/header1.webp', 'label' => esc_html__( 'Header Style 1', 'blogmarks' ), ), 'header_style_2' => array( 'url' => get_template_directory_uri() . '/assets/images/header2.webp', 'label' => esc_html__( 'Header Style 2', 'blogmarks' ), ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_footer_layouts' ) ) : /** * Returns footer layout options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_footer_layouts() { $options = apply_filters( 'blogmarks_footer_layouts', array( 'footer_layout_1' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-4.png', 'label' => esc_html__( 'Four Columns', 'blogmarks' ), ), 'footer_layout_2' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-3.png', 'label' => esc_html__( 'Three Columns', 'blogmarks' ), ), 'footer_layout_3' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-2.png', 'label' => esc_html__( 'Two Columns', 'blogmarks' ), ), 'footer_layout_4' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-2-big-left.png', 'label' => esc_html__( 'Two Columns Big Left', 'blogmarks' ), ), 'footer_layout_5' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-3-big-middle.png', 'label' => esc_html__( 'Three Columns Big Middle', 'blogmarks' ), ), 'footer_layout_6' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-2-big-right.png', 'label' => esc_html__( 'Two Columns Big Right', 'blogmarks' ), ), 'footer_layout_7' => array( 'url' => get_template_directory_uri() . '/assets/images/footer-col-1.png', 'label' => esc_html__( 'Single Column', 'blogmarks' ), ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_general_layouts' ) ) : /** * Returns general layout options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_general_layouts() { $options = apply_filters( 'blogmarks_general_layouts', array( 'left-sidebar' => array( 'url' => get_template_directory_uri() . '/assets/images/left_sidebar.webp', 'label' => esc_html__( 'Left Sidebar', 'blogmarks' ), ), 'right-sidebar' => array( 'url' => get_template_directory_uri() . '/assets/images/right_sidebar.webp', 'label' => esc_html__( 'Right Sidebar', 'blogmarks' ), ), 'no-sidebar' => array( 'url' => get_template_directory_uri() . '/assets/images/no_sidebar.webp', 'label' => esc_html__( 'No Sidebar - Wide', 'blogmarks' ), ), 'no-sidebar-narrow' => array( 'url' => get_template_directory_uri() . '/assets/images/no_sidebar_narrow.webp', 'label' => esc_html__( 'No Sidebar - Narrow', 'blogmarks' ), ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_archive_layouts' ) ) : /** * Returns archive layout options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_archive_layouts() { $options = apply_filters( 'blogmarks_archive_layouts', array( 'archive_style_1' => array( 'url' => get_template_directory_uri() . '/assets/images/archive1.webp', 'label' => esc_html__( 'Single Column List', 'blogmarks' ), ), 'archive_style_2' => array( 'url' => get_template_directory_uri() . '/assets/images/archive2.webp', 'label' => esc_html__( 'Single Column List Alternate', 'blogmarks' ), ), 'archive_style_3' => array( 'url' => get_template_directory_uri() . '/assets/images/archive3.webp', 'label' => esc_html__( 'Full Column', 'blogmarks' ), ), 'archive_style_4' => array( 'url' => get_template_directory_uri() . '/assets/images/archive4.webp', 'label' => esc_html__( 'Full Column', 'blogmarks' ), ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_single_layouts' ) ) : /** * Returns Single Post layout options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_single_layouts() { $options = apply_filters( 'blogmarks_single_layouts', array( 'single_style_1' => esc_html__( 'Style 1', 'blogmarks' ), 'single_style_2' => esc_html__( 'Style 2', 'blogmarks' ), 'single_style_3' => esc_html__( 'Style 3', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_single_navigation_styles' ) ) : /** * Returns Single Post Navigation Style options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_single_navigation_styles() { $options = apply_filters( 'blogmarks_single_navigation_styles', array( 'none' => esc_html__( 'None', 'blogmarks' ), 'style_1' => esc_html__( 'Text Only', 'blogmarks' ), 'style_2' => esc_html__( 'Text + Image', 'blogmarks' ), 'style_3' => esc_html__( 'Image + Text Overlay', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_category_color_display' ) ) : /** * Returns category color display options * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_category_color_display() { $options = apply_filters( 'blogmarks_category_color_display', array( 'none' => __( 'None', 'blogmarks' ), 'as_color' => __( 'As Color', 'blogmarks' ), 'as_bg' => __( 'As Background Color', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_category_styles' ) ) : /** * Returns category styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_category_styles() { $options = apply_filters( 'blogmarks_category_styles', array( 'style_1' => __( 'Style 1', 'blogmarks' ), 'style_2' => __( 'Style 2', 'blogmarks' ), 'style_3' => __( 'Style 3', 'blogmarks' ), 'style_4' => __( 'Style 4', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_tag_styles' ) ) : /** * Returns tag styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_tag_styles() { $options = apply_filters( 'blogmarks_tag_styles', array( 'style_1' => __( 'Style 1', 'blogmarks' ), 'style_2' => __( 'Style 2', 'blogmarks' ), 'style_3' => __( 'Style 3', 'blogmarks' ), 'style_4' => __( 'Style 4', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_read_more_styles' ) ) : /** * Returns read more styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_read_more_styles() { $options = apply_filters( 'blogmarks_read_more_styles', array( 'style_1' => __( 'Style 1', 'blogmarks' ), 'style_2' => __( 'Style 2', 'blogmarks' ), 'style_3' => __( 'Style 3', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_read_more_icons' ) ) : /** * Returns read more icons options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_read_more_icons() { $options = apply_filters( 'blogmarks_read_more_icons', array( '' => array( 'url' => get_template_directory_uri() . '/assets/images/circle-backslash.svg', 'label' => esc_html__( 'None', 'blogmarks' ), ), 'arrow-bar-right' => array( 'url' => get_template_directory_uri() . '/assets/images/arrow-bar-right.svg', 'label' => esc_html__( 'Arrow Bar Right', 'blogmarks' ), ), 'arrow-right' => array( 'url' => get_template_directory_uri() . '/assets/images/arrow-right.svg', 'label' => esc_html__( 'Arrow Right', 'blogmarks' ), ), 'arrow-right-circle' => array( 'url' => get_template_directory_uri() . '/assets/images/arrow-right-circle.svg', 'label' => esc_html__( 'Arrow Right Circle', 'blogmarks' ), ), 'arrow-right-circle-fill' => array( 'url' => get_template_directory_uri() . '/assets/images/arrow-right-circle-fill.svg', 'label' => esc_html__( 'Arrow Right Circle Fill', 'blogmarks' ), ), 'arrow-right-short' => array( 'url' => get_template_directory_uri() . '/assets/images/arrow-right-short.svg', 'label' => esc_html__( 'Arrow Right Short', 'blogmarks' ), ), 'chevron-right' => array( 'url' => get_template_directory_uri() . '/assets/images/chevron-right.svg', 'label' => esc_html__( 'Chevron Right', 'blogmarks' ), ), 'chevron-double-right' => array( 'url' => get_template_directory_uri() . '/assets/images/chevron-double-right.svg', 'label' => esc_html__( 'Chevron Double Right', 'blogmarks' ), ), 'caret-right' => array( 'url' => get_template_directory_uri() . '/assets/images/caret-right.svg', 'label' => esc_html__( 'Caret Right', 'blogmarks' ), ), 'caret-right-fill' => array( 'url' => get_template_directory_uri() . '/assets/images/caret-right-fill.svg', 'label' => esc_html__( 'Caret Right Fill', 'blogmarks' ), ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_read_more_icons_list' ) ) : /** * Returns read more icons for select. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_read_more_icons_list() { $list = array(); $options = blogmarks_get_read_more_icons(); foreach ( $options as $key => $value ) { $list[ $key ] = $value['label']; } return $list; } endif; if ( ! function_exists( 'blogmarks_get_social_links_styles' ) ) : /** * Returns social links styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_social_links_styles() { $options = apply_filters( 'blogmarks_social_links_styles', array( 'style_1' => __( 'Style 1', 'blogmarks' ), 'style_2' => __( 'Style 2', 'blogmarks' ), 'style_3' => __( 'Style 3', 'blogmarks' ), 'style_4' => __( 'Style 4', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_widget_styles_arr' ) ) : /** * Returns widget styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_widget_styles_arr() { $options = apply_filters( 'blogmarks_widget_styles_arr', array( 'style_1' => __( 'Plain', 'blogmarks' ), 'style_2' => __( 'Bordered', 'blogmarks' ), 'style_3' => __( 'Border Below', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_title_styles' ) ) : /** * Returns title styles options. * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_title_styles() { $options = apply_filters( 'blogmarks_title_styles', array( 'style_1' => __( 'Style 1', 'blogmarks' ), 'style_2' => __( 'Style 2', 'blogmarks' ), 'style_3' => __( 'Style 3', 'blogmarks' ), 'style_4' => __( 'Style 4', 'blogmarks' ), 'style_5' => __( 'Style 5', 'blogmarks' ), 'style_6' => __( 'Style 6', 'blogmarks' ), 'style_7' => __( 'Style 7', 'blogmarks' ), 'style_8' => __( 'Style 8', 'blogmarks' ), 'style_9' => __( 'Style 9', 'blogmarks' ), 'style_10' => __( 'Style 10', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_title_alignments' ) ) : /** * Returns title Alignments * * @since 1.0.0 * * @return array Options array. */ function blogmarks_get_title_alignments() { $options = apply_filters( 'blogmarks_title_alignments', array( 'left' => __( 'Left', 'blogmarks' ), 'center' => __( 'Center', 'blogmarks' ), 'right' => __( 'Right', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_sidebar_widget_style' ) ) : /** * Returns sidebar widget style * * @since 1.0.0 * * @return string style */ function blogmarks_get_sidebar_widget_style() { if ( is_front_page() ) { $widget_style = blogmarks_get_option( 'home_sidebar_widget_style', 'style_1' ); } else { $widget_style = blogmarks_get_option( 'sidebar_widget_style', 'style_1' ); } return 'wpintf-sidebar-widget-' . $widget_style; } endif; if ( ! function_exists( 'blogmarks_get_sidebar_heading_style' ) ) : /** * Returns sidebar widget heading style * * @since 1.0.0 * * @return string heading_style */ function blogmarks_get_sidebar_heading_style() { if ( is_front_page() ) { $heading_style = blogmarks_get_option( 'home_sidebar_widget_heading_style', 'style_5' ); } else { $heading_style = blogmarks_get_option( 'sidebar_widget_heading_style', 'style_5' ); } return 'site-section-title-' . $heading_style; } endif; if ( ! function_exists( 'blogmarks_get_sidebar_heading_align' ) ) : /** * Returns sidebar widget heading align * * @since 1.0.0 * * @return string heading_align */ function blogmarks_get_sidebar_heading_align() { if ( is_front_page() ) { $heading_align = blogmarks_get_option( 'home_sidebar_widget_heading_align', 'center' ); } else { $heading_align = blogmarks_get_option( 'sidebar_widget_heading_align', 'center' ); } return 'site-section-title-align-' . $heading_align; } endif; if ( ! function_exists( 'blogmarks_in_multi_array' ) ) : /** * Returns true/false if the key exists in array * * @since 1.0.0 * * @param string $needle * @param array $haystack * * @return boolean Key exists/not */ function blogmarks_in_multi_array( $needle, $haystack ) { if ( array_key_exists( $needle, $haystack ) or in_array( $needle, $haystack ) ) { return true; } else { $return = false; foreach ( array_values( $haystack ) as $value ) { if ( is_array( $value ) and ! $return ) { $return = blogmarks_in_multi_array( $needle, $value ); } } return $return; } } endif; if ( ! function_exists( 'blogmarks_hex2rbga' ) ) : /**Convert hex to rbga * * @since 1.0.0 * * @param $color string Hex color * @param $opacity int Opacity */ function blogmarks_hex2rbga( $color, $opacity = false ) { $default = 'rgb(0,0,0)'; // Return default if no color provided. if ( empty( $color ) ) { return $default; } // Sanitize $color if "#" is provided. if ( $color[0] == '#' ) { $color = substr( $color, 1 ); } // Check if color has 6 or 3 characters and get values. if ( strlen( $color ) == 6 ) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } // Convert hexadec to rgb. $rgb = array_map( 'hexdec', $hex ); // Check if opacity is set(rgba or rgb). if ( $opacity ) { if ( abs( $opacity ) > 1 ) { $opacity = 1.0; } $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')'; } else { $output = 'rgb(' . implode( ',', $rgb ) . ')'; } // Return rgb(a) color string. return $output; } endif; if ( ! function_exists( 'blogmarks_estimated_read_time' ) ) : /** * Estimated reading time in minutes * * @param $content * @param $with_gutenberg * * @return int estimated time in minutes */ function blogmarks_estimated_read_time( $content = '', $with_gutenberg = false ) { // In case if content is build with gutenberg parse blocks. if ( $with_gutenberg ) { $blocks = parse_blocks( $content ); $contentHtml = ''; foreach ( $blocks as $block ) { $contentHtml .= render_block( $block ); } $content = $contentHtml; } // Remove HTML tags from string. $content = wp_strip_all_tags( $content ); // When content is empty return 0. if ( ! $content ) { return 0; } // Count words containing string. $words_count = str_word_count( $content ); // Words per minute. $words_per_minute = 200; // Calculate time for read all words and round. $minutes = ceil( $words_count / $words_per_minute ); return $minutes; } endif; if ( ! function_exists( 'blogmarks_print_first_instance_of_block' ) ) : /** Print the first instance of a block in the content, and then break away. * * @param string $block_name The full block type name, or a partial match. * Example: `core/image`, `core-embed/*`. * @param string|null $content The content to search in. Use null for get_the_content(). * @param int $instances How many instances of the block will be printed (max). Default 1. * @return bool Returns true if a block was located & printed, otherwise false. */ function blogmarks_print_first_instance_of_block( $block_name, $content = null, $instances = 1 ) { $instances_count = 0; $blocks_content = ''; if ( ! $content ) { $content = get_the_content(); } // Parse blocks in the content. $blocks = parse_blocks( $content ); // Loop blocks. foreach ( $blocks as $block ) { // Sanity check. if ( ! isset( $block['blockName'] ) ) { continue; } // Check if this the block matches the $block_name. $is_matching_block = false; // If the block ends with *, try to match the first portion. if ( '*' === $block_name[-1] ) { $is_matching_block = 0 === strpos( $block['blockName'], rtrim( $block_name, '*' ) ); } else { $is_matching_block = $block_name === $block['blockName']; } if ( $is_matching_block ) { // Increment count. ++$instances_count; // Add the block HTML. $blocks_content .= render_block( $block ); // Break the loop if the $instances count was reached. if ( $instances_count >= $instances ) { break; } } } if ( $blocks_content ) { /** This filter is documented in wp-includes/post-template.php */ echo apply_filters( 'the_content', $blocks_content ); // phpcs:ignore WordPress.Security.EscapeOutput return true; } return false; } endif; if ( ! function_exists( 'blogmarks_excerpt_length' ) ) { /** * Change Excerpt Length * * @param string $length of the excerpt. */ function blogmarks_excerpt_length( $length ) { if ( is_admin() && ! wp_doing_ajax() ) { return $length; } $length = blogmarks_get_option( 'excerpt_length', 40 ); return $length; } } // add_filter( 'excerpt_length', 'blogmarks_excerpt_length' ); if ( ! function_exists( 'blogmarks_more' ) ) { /** * Change Excerpt Suffix * * @param string $more suffix for the excerpt. */ function blogmarks_excerpt_more( $more ) { return '…'; } } // add_filter( 'excerpt_more', 'blogmarks_excerpt_more' ); if ( ! function_exists( 'blogmarks_archive_title_prefix_wrapper' ) ) : /** * Wrap prefix * * @return string Prefix */ function blogmarks_archive_title_prefix_wrapper( $prefix ) { return '' . $prefix . ''; } endif; // add_filter( 'get_the_archive_title_prefix', 'blogmarks_archive_title_prefix_wrapper' ); if ( ! function_exists( 'blogmarks_get_localized_variables' ) ) { /** * Get array of localized variables * * @return array Array of localized vairables */ function blogmarks_get_localized_variables() { $args = array(); /*For Ajax Load Posts*/ $args['nonce'] = wp_create_nonce( 'blogmarks-load-more-nonce' ); $args['ajaxurl'] = admin_url( 'admin-ajax.php' ); if ( is_front_page() ) { $args['post_type'] = 'post'; } /*Support for custom post types*/ if ( is_post_type_archive() ) { $args['post_type'] = get_queried_object()->name; } /*Support for categories and taxonomies*/ if ( is_category() || is_tag() || is_tax() ) { $args['cat'] = get_queried_object()->slug; $args['taxonomy'] = get_queried_object()->taxonomy; /*Get the associated post type for custom taxonomy*/ if ( is_tax() ) { global $wp_taxonomies; $tax_object = isset( $wp_taxonomies[ $args['taxonomy'] ] ) ? $wp_taxonomies[ $args['taxonomy'] ]->object_type : array(); $args['post_type'] = array_pop( $tax_object ); } } /*Support for search*/ if ( is_search() ) { $args['search'] = get_search_query(); } /*Support for author*/ if ( is_author() ) { $args['author'] = get_the_author_meta( 'user_nicename' ); } /*Support for date archive*/ if ( is_date() ) { $args['year'] = get_query_var( 'year' ); $args['month'] = get_query_var( 'monthnum' ); $args['day'] = get_query_var( 'day' ); } global $wp_query; $arggs['nonce'] = wp_create_nonce( 'blogmarks-load-more-nonce' ); $arggs['ajaxurl'] = admin_url( 'admin-ajax.php' ); $arggs['posts'] = json_encode( $wp_query->query_vars ); $arggs['current_page'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $arggs['max_page'] = $wp_query->max_num_pages; return $args; } } if ( ! function_exists( 'blogmarks_post_image' ) ) : /** * Display post image. * * @param string $image_size Image Size to fetch * @param boolean $bg Image in background * * @since 1.1.0 */ function blogmarks_post_image( $image_size = 'thumbnail', $bg = false ) { $class = ''; if ( true == $bg ) { $class = 'blogmarks-bg-image'; } ?>
the_title_attribute( array( 'echo' => false, ) ), ) ); ?>
__( '— No Limit —', 'blogmarks' ), 'limit-clamp-1' => __( '1 Line', 'blogmarks' ), 'limit-clamp-2' => __( '2 Lines', 'blogmarks' ), 'limit-clamp-3' => __( '3 Lines', 'blogmarks' ), 'limit-clamp-4' => __( '4 Lines', 'blogmarks' ), 'limit-clamp-5' => __( '5 Lines', 'blogmarks' ), ) ); return $options; } endif; if ( ! function_exists( 'blogmarks_get_archive_excerpt' ) ) : /** * Get archive excerpt * * @since 1.0.0 * * @return string Page ID. */ function blogmarks_get_archive_excerpt() { $excerpt_length = blogmarks_get_option( 'excerpt_length', 24 ); return wp_trim_words( get_the_excerpt(), $excerpt_length, '…' ); } endif; if ( ! function_exists( 'blogmarks_the_archive_excerpt' ) ) : /** * Print archive excerpt * * @since 1.0.0 * * @return string Page ID. */ function blogmarks_the_archive_excerpt() { echo wpautop( wp_kses_post( blogmarks_get_archive_excerpt() ) ); } endif;