max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%'; ?> $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'prev_next' => true, 'prev_text' => esc_html__('« Previous', 'blogbend'), 'next_text' => esc_html__('Next »', 'blogbend'), 'add_args' => array_map('urlencode', $query_args), )); ?> post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> %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()) ); ?> ' . $time_string . '' ); echo $posted_on; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } ?> 'byline-img'] ); ?> $limit) { $categories = array_slice($categories, 0, $limit); } } if (null == $show_color) { $show_color = 'none'; } $wrapper_class = ' categories-' . $show_color; ?>
using_permalinks()) ? 'rel="category tag"' : 'rel="category"'; $separator = ' '; $cat_list = ''; $i = 0; foreach ($categories as $category) { $class = ''; if (0 < $i) { $cat_list .= $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 ('has-text-color' == $show_color) : $class = ' class="has-text-color"'; endif; if ('has-background' == $show_color) : $class = ' class="has-background-color"'; endif; } $cat_list .= '' . $category->name . ''; ++$i; } echo $cat_list; ?>
]+)>([^<]+)<\/a>/', '#\2', $tags_list); $tags_content .= $tags_list; } // Output the tags with a wrapper and label. echo '
'; echo '' . esc_html($tags_label) . ''; echo wp_kses_post($tags_content); echo '
'; } } endif; /** * Flush out the transients used in blogbend_categorized_blog. */ function blogbend_category_transient_flusher() { // Like, beat it. Dig? delete_transient('blogbend_categories'); } add_action('edit_category', 'blogbend_category_transient_flusher'); add_action('save_post', 'blogbend_category_transient_flusher'); if (!function_exists('blogbend_get_rendered_content')) : /** * Return the rendered post content. * * This is the same as the_content() except for the fact that it doesn't display the content, but returns it. * Do make sure not to use this function twice for a post inside the loop, because it would defeat the purpose. * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. * @return string */ function blogbend_get_rendered_content($more_link_text = null, $strip_teaser = false) { $content = get_the_content($more_link_text, $strip_teaser); /** * Filters the post content. * * @param string $content Content of the current post. * @since 0.71 * */ $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } endif; if (!function_exists('blogbend_first_content_character')) : /** * Returns the first UTF-8 character of the content * returns empty string if nothing found * * @param string $content The content to extract the first character from. * @return string */ function blogbend_first_content_character($content = '') { //no need for this when a password is required if (post_password_required()) { return ''; } // By default we have no first letter $first_letter = ''; if (empty($content)) { // If we haven't been provided with a rendered content (with all shortcodes run, etc), // we need to get our own. $content = get_the_content(); // remove [caption] shortcode // because if it is the first part of the content we don't need the caption $content = trim(preg_replace("/\[caption.*\[\/caption\]/si", '', $content)); //now apply the regular filters, without the captions $content = apply_filters('the_content', $content); } // Bail if we have no content to work with if (empty($content)) { return $first_letter; } // We need to make sure that we don't look at strings inside
s - those are probably captions - // or embeds - Twitter (usually inside divs with some embed class) // This is why we want to remove the tags and their content // We are only interested in the beginning of the the content, not the whole // This is why we are using preg_replace, not preg_replace_all $content = preg_replace("//siU", '', $content); $content = preg_replace("//siU", '', $content); // Strip all the tags that are left and use what we are left with $content = wp_strip_all_tags(html_entity_decode($content)); // Find the first alphanumeric character - multibyte preg_match('/[\p{Xan}]/u', $content, $results); if (!empty($results)) { $first_letter = reset($results); } else { // Lets try the old fashion way // Find the first alphanumeric character - non-multibyte preg_match('/[a-zA-Z\d]/', $content, $results); if (!empty($results)) { $first_letter = reset($results); } }; return $first_letter; } endif; if (!function_exists('blogbend_get_post_format_first_image')) : function blogbend_get_post_format_first_image() { global $post; $output = preg_match('//i', $post->post_content, $matches); if (empty($matches[0])) { return ''; } return $matches[0]; } endif; if (!function_exists('blogbend_get_post_format_link_url')) : /** * Returns the URL to use for the link post format. * * First it tries to get the first URL in the content; if not found it uses the permalink instead * * @return string URL */ function blogbend_get_post_format_link_url() { $content = get_the_content(); $has_url = get_url_in_content($content); return ($has_url) ? $has_url : apply_filters('the_permalink', esc_url(get_permalink())); } endif; /** * Handles the output of the media for audio attachment posts. This should be used within The Loop. * * @return string */ function blogbend_audio_attachment() { return blogbend_hybrid_media_grabber(array('type' => 'audio', 'split_media' => true)); } /** * Handles the output of the media for video attachment posts. This should be used within The Loop. * * @return string */ function blogbend_video_attachment() { return blogbend_hybrid_media_grabber(array('type' => 'video', 'split_media' => true)); } if (!function_exists('blogbend_get_rendered_content')) : /** * Return the rendered post content. * * This is the same as the_content() except for the fact that it doesn't display the content, but returns it. * Do make sure not to use this function twice for a post inside the loop, because it would defeat the purpose. * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. * @return string */ function blogbend_get_rendered_content($more_link_text = null, $strip_teaser = false) { $content = get_the_content($more_link_text, $strip_teaser); /** * Filters the post content. * * @param string $content Content of the current post. * @since 0.71 * */ $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } endif; if (!function_exists('wp_body_open')) : /** * Fire the wp_body_open action. * * Added for backwards compatibility to support pre 5.2.0 WordPress versions. * * @since BlogBend 1.0.0 */ function wp_body_open() { /** * Triggered after the opening tag. * * @since BlogBend 1.0.0 */ do_action('wp_body_open'); } endif; function blogbend_excerpt_more($more) { return ' ' . __('Continue reading', 'blogbend') . ''; } add_filter('excerpt_more', 'blogbend_excerpt_more'); if (!function_exists('blogbend_get_page_layout')) : /** * Get Page Layout based on the post meta or customizer value * * @return string Page Layout. * @since 1.0.0 * */ function blogbend_get_page_layout() { global $post; $page_layout = ''; // Fetch from Post Meta on single posts or pages. if ($post && is_singular()) { $page_layout = get_post_meta($post->ID, 'blogbend_page_layout', true); if (empty($page_layout) && is_single()) { $page_layout = get_theme_mod('select_single_sidebar','right_sidebar'); } } // Fetch from customizer if everything else fails. if (empty($page_layout)) { $page_layout = get_theme_mod('select_single_sidebar','right_sidebar'); } return $page_layout; } endif;