%2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( DATE_W3C ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( DATE_W3C ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( /* translators: %s: post date. */ esc_html_x( 'Posted on %s', 'post date', 'blogmarks' ), '' . $time_string . '' ); echo '' . $posted_on . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } endif; if ( ! function_exists( 'blogmarks_posted_by' ) ) : /** * Prints HTML with meta information for the current author. */ function blogmarks_posted_by() { $byline = sprintf( /* translators: %s: post author. */ esc_html_x( 'by %s', 'post author', 'blogmarks' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } endif; if ( ! function_exists( 'blogmarks_get_single_post_metas' ) ) : /** * Get allowed single post meta based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_get_single_post_metas( $post_id ) { // Check if the metas are overridden in post meta. $override_post_metas = get_post_meta( $post_id, 'blogmarks_override_post_metas', true ); if ( $override_post_metas ) { $enabled_post_meta = get_post_meta( $post_id, 'blogmarks_single_post_metas', true ); } else { $enabled_post_meta = blogmarks_get_option( 'single_post_meta', array( 'author', 'date', 'comment', 'category', 'tags' ) ); } // Return an empty array if all options are unchecked. if ( $enabled_post_meta ) { return $enabled_post_meta; } else { return array(); } } endif; if ( ! function_exists( 'blogmarks_show_single_post_meta_icons' ) ) : /** * Get if post meta icons is enabled based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_show_single_post_meta_icons( $post_id ) { $show_single_post_meta_icons = get_post_meta( $post_id, 'blogmarks_show_post_meta_icons', true ); if ( '0' == $show_single_post_meta_icons ) { $show_single_post_meta_icons = false; } elseif ( '1' == $show_single_post_meta_icons ) { $show_single_post_meta_icons = true; } else { $show_single_post_meta_icons = blogmarks_get_option( 'show_single_post_meta_icon', true ); } return $show_single_post_meta_icons; } endif; if ( ! function_exists( 'blogmarks_show_author_info' ) ) : /** * Get if author info is enabled based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_show_author_info( $post_id ) { $show_author_info = get_post_meta( $post_id, 'blogmarks_show_author_info', true ); if ( '0' == $show_author_info ) { $show_author_info = false; } elseif ( '1' == $show_author_info ) { $show_author_info = true; } else { $show_author_info = blogmarks_get_option( 'show_author_info' ); } return $show_author_info; } endif; if ( ! function_exists( 'blogmarks_show_related_posts' ) ) : /** * Get if related posts are enabled based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_show_related_posts( $post_id ) { $show_related_posts = get_post_meta( $post_id, 'blogmarks_show_related_posts', true ); if ( '0' == $show_related_posts ) { $show_related_posts = false; } elseif ( '1' == $show_related_posts ) { $show_related_posts = true; } else { $show_related_posts = blogmarks_get_option( 'show_related_posts' ); } return $show_related_posts; } endif; if ( ! function_exists( 'blogmarks_show_sticky_article_navigation' ) ) : /** * Get if related posts are enabled based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_show_sticky_article_navigation( $post_id ) { $show_sticky_article_nav = get_post_meta( $post_id, 'blogmarks_show_sticky_article_navigation', true ); if ( '0' == $show_sticky_article_nav ) { $show_sticky_article_nav = false; } elseif ( '1' == $show_sticky_article_nav ) { $show_sticky_article_nav = true; } else { $show_sticky_article_nav = blogmarks_get_option( 'sticky_article_navigation' ); } return $show_sticky_article_nav; } endif; if ( ! function_exists( 'blogmarks_show_author_posts' ) ) : /** * Get if author posts are enabled based on post meta/customizer * * @param int $post_id Post ID. */ function blogmarks_show_author_posts( $post_id ) { $show_author_posts = get_post_meta( $post_id, 'blogmarks_show_author_posts', true ); if ( '0' == $show_author_posts ) { $show_author_posts = false; } elseif ( '1' == $show_author_posts ) { $show_author_posts = true; } else { $show_author_posts = blogmarks_get_option( 'show_author_posts' ); } return $show_author_posts; } endif; if ( ! function_exists( 'blogmarks_post_meta_info' ) ) : /** * Display post meta info. * * @param array $enabled_post_meta Enabled Post Meta. * @param string $settings Additinal Settings * * @since 1.0.0 */ function blogmarks_post_meta_info( $enabled_post_meta = array(), $settings = array() ) { if ( $enabled_post_meta && ! empty( $enabled_post_meta ) ) : // Filter out valid metas. $valid_post_metas = array( 'author', 'read_time', 'date', 'comment' ); $enabled_post_meta = array_intersect( $enabled_post_meta, $valid_post_metas ); $enabled_post_meta = array_values( $enabled_post_meta ); if ( ! empty( $enabled_post_meta ) ) : $wrapper_class = ''; if ( empty( $settings ) || ! is_array( $settings ) ) { $settings = array( 'date_format' => 'format_2', 'author_image' => false, 'show_icons' => true, ); } else { if ( ! isset( $settings['date_format'] ) ) { $settings['date_format'] = 'format_2'; } if ( ! isset( $settings['author_image'] ) ) { $settings['author_image'] = false; } if ( ! isset( $settings['show_icons'] ) ) { $settings['show_icons'] = true; } } ?> $limit ) { $categories = array_slice( $categories, 0, $limit ); } } if ( null == $display_style ) { $display_style = 'style_1'; } if ( null == $show_color ) { $show_color = 'none'; } $wrapper_class = $display_style . ' cat-color-' . $show_color; ?>
using_permalinks()) ? 'rel="category tag"' : 'rel="category"'; $separator = ' '; $thelist = ''; $i = 0; foreach ($categories as $category) { $class = ''; if (0 < $i) { $thelist .= $separator; } $build_style_attr = ''; if ('none' != $show_color) { $color = get_term_meta($category->term_id, 'category_color', true); if ($color) { $build_style_attr = str_replace('value', $color, $style_attr); } else { $build_style_attr = ''; } if ('as_bg' == $show_color) : $class = ' class="has-bg-color"'; endif; } $thelist .= '' . $category->name . ''; ++$i; } echo $thelist; ?>
$limit ) { $tags = array_slice( $tags, 0, $limit ); } } if ( null == $style ) { $style = 'style_1'; } ?>
" . $tag->name . ''; ++$i; } echo $thelist; ?>
%s', 'blogmarks' ), array( 'span' => array( 'class' => array(), ), ) ), wp_kses_post( get_the_title() ) ), '' ); } endif; if ( ! function_exists( 'blogmarks_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. */ function blogmarks_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! empty( $user ) && ! empty( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } /** * Adds a Sub Nav Toggle to Menu * * @since Blogmarks 1.0 * * @param stdClass $args An object of wp_nav_menu() arguments. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @return stdClass An object of wp_nav_menu() arguments. */ function blogmarks_add_sub_toggles_to_main_menu( $args, $item, $depth ) { if ( 'primary-menu' === $args->theme_location && ( isset( $args->show_toggles ) && $args->show_toggles ) ) { // Wrap the menu item link contents in a div, used for positioning. $args->before = '
'; $args->after = ''; // Add a toggle to items with children. if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { $toggle_target_string = '.site-responsive-menu .menu-item-' . $item->ID . ' > .sub-menu'; // Add the sub menu toggle. $args->after .= ''; } // Close the wrapper. $args->after .= '
'; // Add sub menu icons to the primary menu without toggles. } elseif ( 'primary-menu' === $args->theme_location ) { if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { $args->link_after = '' . blogmarks_get_theme_svg( 'chevron-down' ) . ''; } else { $args->link_after = ''; } } return $args; } add_filter( 'nav_menu_item_args', 'blogmarks_add_sub_toggles_to_main_menu', 10, 3 ); /** * Displays SVG icons in social links menu. * * @since Blogmarks 1.0 * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of the menu. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @return string The menu item output with social icon. */ function blogmarks_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Change SVG icon inside social links menu if there is supported URL. if ( 'social-menu' === $args->theme_location ) { $svg = Blogmarks_SVG_Icons::get_social_link_svg( $item->url ); if ( empty( $svg ) ) { $svg = blogmarks_get_theme_svg( 'link' ); } $item_output = str_replace( $args->link_before, $svg . $args->link_before, $item_output ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'blogmarks_nav_menu_social_icons', 10, 4 ); /** * Displays menu description in primary menu * * @since Blogmarks 1.0 * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of the menu. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @return string The menu item output with menu description. */ function blogmarks_show_main_menu_nav_description( $item_output, $item, $depth, $args ) { if ( ! empty( $item->description ) ) { $item_output = str_replace( $args->link_after . '', '' . $item->description . '' . $args->link_after . '', $item_output ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'blogmarks_show_main_menu_nav_description', 10, 4 );