function the_subtitle($before = '', $after = '') { $id = get_the_ID() !== '' ? get_the_ID() : false; if (get_the_subtitle() !== '') { echo $before . apply_filters('the_subitle', get_the_subtitle($id)) . $after; } }
/** * The Subtitle * * Display or retrieve the current post subtitle with optional content. * * This works exactly the same way that the_title() works in WordPress. * * @param string $before Optional. Content to prepend to the subtitle. * @param string $after Optional. Content to append to the subtitle. * @param bool $echo Optional, default to true.Whether to display or return. * @return null|string Null on no subtitle. String if $echo parameter is false. * @since 1.0.0 */ function the_subtitle($before = '', $after = '', $echo = true) { $subtitle = get_the_subtitle(); if (0 == strlen($subtitle)) { return; } $subtitle = $before . $subtitle . $after; if ($echo) { echo $subtitle; } else { return $subtitle; } }
function cinnamon_subtitles_posted_on($posted_on, $post_id) { // Get subtitles $subtitle = get_the_subtitle($post_id); if ($subtitle && is_singular()) { $entry_subtitle = cinnamon_get_entry_subtitle($post_id); if ($entry_subtitle) { return sprintf(__('%s under <span class="taxonomies">%s</span>', 'cinnamon'), $posted_on, $entry_subtitle); } else { return $posted_on; } } else { return $posted_on; } }
/** * [wp_subtitle] Shortcode * * @since 2.5 * * Outputs the post subtitle. * * If the [wp_subtitle] shortcode tag is wrapped around content, that * content will be used as a fallback if no subtitle is specified. * e.g. [wp_subtitle]Fallback Subtitle[/wp_subtitle] * * @param array $atts Shortcode attributes. * @param string $content Fallback content (content between the shortcode tags). * @return string Subtitle HTML. */ public static function shortcode($atts, $content = null) { global $post; $atts = shortcode_atts(array('tag' => self::get_default_tag(), 'before' => '', 'after' => ''), $atts, 'wp_subtitle'); // Get HTML tag if (!empty($atts['tag'])) { $tag = self::validate_tag($atts['tag']); $before = sprintf('<%s class="wp-subtitle">', $tag); $after = sprintf('</%s>', $tag); } else { $before = ''; $after = ''; } // Add before/after content $before .= self::format_subtitle_content($atts['before'], 'before'); $after = self::format_subtitle_content($atts['after'], 'after') . $after; return get_the_subtitle($post->ID, $before, $after, false); }
/** * The Subtitle * * @since 1.0 * * @uses get_the_subtitle() * * @param string $before Before the subtitle. * @param string $after After the subtitle. * @param bool $echo Output if true, return if false. * @return string The subtitle string. */ function the_subtitle($before = '', $after = '', $echo = true) { return get_the_subtitle(0, $before, $after, $echo); }
/** * Build Subtitle column content for post, pages, and custom post types. * * @see function is_admin * @see function get_the_subtitle * @since 2.1.0 * @access public */ public function build_subtitles_column_content($column_name, $post_id) { if (!is_admin() || 'subtitle' !== $column_name) { return; } $subtitle = get_the_subtitle($post_id); if (!empty($subtitle)) { echo $subtitle; // WPCS: XSS OK } }
<?php /** * The template used for displaying testimonials. * * @package Checkout */ $add_class = has_post_thumbnail() ? 'with-featured-image' : 'without-featured-image'; // Check for subtitles $testimonial_subtitle = function_exists('get_the_subtitle') && '' != get_the_subtitle() ? ' with-subtitle' : ' without-subtitle'; ?> <article id="post-<?php the_ID(); ?> " <?php post_class($add_class . $testimonial_subtitle . ' post'); ?> > <div class="entry-content"> <?php the_content(); ?> </div> <?php if (has_post_thumbnail()) { ?> <span class="testimonial-thumbnail"> <?php the_post_thumbnail('testimonial-thumb'); ?>
/** * Make sure that Subtitles plays nice with WordPress SEO plugin by Yoast. * * The plugin features breadcrumb functionality, which users can add into their themes * by using functionality that's specific to the plugin. Because it's so popular and * I'm not sure where or how people will insert their breadcrumbs into their template * files, it's best avoid messing with the plugin altogether. We'll filter the output * and make sure that subtitles isn't included in any of the breadcrumb titles. * * @link https://wordpress.org/plugins/wordpress-seo/ * @link https://github.com/philiparthurmoore/Subtitles/issues/5 * @link http://us1.php.net//manual/en/function.strlen.php * @see get_the_subtitle() * * @since 1.0.1 */ public function plugin_compat_wordpress_seo($title) { /** * This issue only arrises when breadcrumbs are placed inside of The Loop, * so we'll first check to see if we're in The Loop, and if not, just bail * on this altogether. * * @link http://codex.wordpress.org/Function_Reference/in_the_loop * * @since 1.0.1 */ $in_the_loop = (bool) in_the_loop(); if (!$in_the_loop) { return $title; } /** * Grab the post subtitle. * * Example: (string) "Subtitle" * * @see get_the_subtitle() * * @since 1.0.1 */ $post_subtitle = get_the_subtitle(); /** * Grab the length of the post subtitle. * * We're also using a negative value of the legnth of the subtitle. * * Example: (int) 8 * * @link http://us1.php.net//manual/en/function.strlen.php * * @since 1.0.1 */ $post_subtitle_length = (int) strlen($post_subtitle); $post_subtitle_length_neg = -1 * $post_subtitle_length; /** * Grab the already filtered post title. * * Example: (string) "Post TitleSubtitle" */ $post_title = $title; /** * Grab the length of the filtered post title. * * Example: (int) 18 */ $post_title_length = (int) strlen($post_title); /** * Check for a few specific cases: * * 1. Does the subtitle of the current post equal the title of any of its ancestors? * 2. Is the post title that's being checked empty? * * If so, then bail out on this. * * Example: If the subtitle of the page is "Features" and one of the parent breadcrumbs also * has the name "Features", then we don't want to mess that up, so we'll make sure that we bail out * early on this function. * * @since 1.0.1 */ if ($post_title == $post_subtitle || '' == $post_title) { return $title; } /** * Remove the subtitle from the "title" string so that it shows up properly. * * Example: If the post title that we've brought into the function is called "Post TitleSubtitle", * then all we really want is the the title to say "Post Title", so we'll use the length of the subtitle * to cut that many characters off of the end of the post title, and hope to end up with "Post Title". * * @see apply_filters() * @link http://us2.php.net//manual/en/function.substr.php * * @since 1.0.1 */ $post_title = substr($post_title, 0, $post_subtitle_length_neg); $post_title = apply_filters('compat_wordpress_seo', $post_title); /** * Make sure that the new title and its subtitle is the right string that * we want to manipulate, by comparing the post title + subtitle against * the original title that we brought into this function. * * Example: The original title brought in was "Post TitleSubtitle", so we'll * make sure that "Post Title" + "Subtitle" is actually "Post TitleSubtitle". * * @since 1.0.1 */ $reconstructed_title = $post_title . $post_subtitle; if ($reconstructed_title == $title) { return $post_title; } // else just return the title that was brought into the function return $title; }
?> | <?php the_author(); ?> | <?php echo get_the_date(); ?> </a><?php _e('', 'renkon'); ?> </div> </header><div class="entry-postformat3"> <?php get_the_subtitle(); ?> </div> <div class="entry-content"> <?php if (is_search()) { // Show excerpts on search results. ?> <?php the_excerpt(); ?> <?php } else { ?>
<?php $editorial_three_the_title = get_the_title(); $editorial_three_get_permalink = get_permalink(); if(function_exists("the_subtitle")) { $editorial_three_the_subtitle = get_the_subtitle(); } $date_u = current_time('timestamp'); $post_time = get_post_time('U'); $post_age = $date_u - $post_time; $post_age_in_hours = $post_age/3600; $post_age_in_minutes = $post_age/60;
</figure> <div class="overflow overflow--black untouchable"></div> <div id="title-<?php the_ID(); ?> " class="wrap wrap--title wrap--title__article"> <div class="wrap wrap--position"> <h2 class="title title--article" ><?php echo get_the_title($post_id); ?> </h2> <?php if (function_exists('the_subtitle')) { ?> <h3 class="title title--article__sub"><?php echo get_the_subtitle($post_id); ?> </h3> <?php } ?> </div> </div> <div class="wrap wrap--category"> <p><?php the_category(', '); ?> </p> </div> </header> </section><!-- end of thumbnail -->
$blog_id = get_the_id(); } $page_id = 'page' == get_option('show_on_front') ? get_option('page_for_posts') : $blog_id; // Get post and page subtitles if (is_singular() && function_exists('the_subtitle')) { ?> <?php the_subtitle('<p class="entry-subtitle">', '</p>'); ?> <?php } elseif (is_home() && !is_front_page()) { ?> <?php if (function_exists('get_the_subtitle')) { echo '<p class="entry-subtitle">'; echo get_the_subtitle($page_id); echo '</p>'; } ?> <?php } ?> <?php // Show the custom header text and button on homepage templates if (is_page_template('templates/template-homepage-widgets.php') || is_page_template('templates/template-homepage-shop.php') || is_page_template('templates/template-homepage-portfolio.php')) { // Get the first CTA button link from Appearance > Customize > Theme Options -> Homepage Header Section if (get_theme_mod('checkout_header_button_one_link')) { $button_page_id = get_theme_mod('checkout_header_button_one_link'); $button_url = get_permalink($button_page_id); if (get_option('checkout_header_button_one_text')) {
* * @package pgb */ ?> <div class="col-md-12"> <?php if (is_front_page()) { printf('<h1 class="page-title">%s</h1>', get_bloginfo('name')); printf('<h3 class="page-sub-title">%s</h3>', get_bloginfo('description')); } elseif (is_single() || is_page()) { the_title('<h1 class="page-title">', '</h1>'); the_subtitle('<h3 class="page-sub-title">', '</h3>'); } elseif (is_blog_page()) { blog_page_title(); get_the_subtitle(blog_page_id(), '<h3 class="page-sub-title">', '</h3>', true); } elseif (is_search()) { printf('<h1 class="page-title">%s%s</h1>', __('Search Results for: ', 'pgb'), '<span>' . get_search_query() . '</span>'); } elseif (is_archive()) { if (is_category()) { printf('<h1 class="page-title">%s</h1>', single_cat_title('', false)); } elseif (is_tag()) { printf('<h1 class="page-title">%s</h1>', single_tag_title('', false)); } elseif (is_author()) { /* Queue the first post, that way we know * what author we're dealing with (if that is the case). */ the_post(); printf('<h1 class="page-title">%s%s</h1>', __('Author: ', 'pgb'), '<span class="vcard">' . get_the_author() . '</span>'); /* Since we called the_post() above, we need to * rewind the loop back to the beginning that way
/** * Get subtitle, the additional title of posts, extra for widgets * * @param $tag String * @param $link Boolean * @param $echo Boolean * @return void */ function xtreme_widget_post_subtitle($tag = 'h4', $link = FALSE, $echo = TRUE) { if (!current_theme_supports('xtreme-subtitles')) { return; } $pt = get_post_type(get_the_ID()); $spt = get_theme_support('xtreme-subtitles'); if (!in_array($pt, $spt[0])) { return; } if (!has_subtitle()) { return; } $default_allowed_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div'); // Hook for change the allowed tags $allowed_tags = apply_filters('xtreme_widget_allowed_tags_post_subtitle', $default_allowed_tags); $open_link = ''; $close_link = ''; if (!in_array($tag, $allowed_tags)) { $tag = 'h4'; } if ($link) { $open_link = sprintf('<a href="%s" rel="bookmark" title="' . esc_attr__('Permalink to %s', XF_TEXTDOMAIN) . '">', get_permalink(), the_title_attribute('echo=0')); $close_link = '</a>'; } do_action('xtreme_widget_before_post_subtitle'); $output = sprintf('<%1$s class="subtitle">%3$s%2$s%4$s</%1$s>', $tag, get_the_subtitle(), $open_link, $close_link); if ($echo) { echo $output; } else { return $output; } do_action('xtreme_widget_after_post_subtitle'); }
function bootplate_subtitle() { global $post; //$id = get_the_ID(); if (have_bootplate_subtitle('name') == 'wp-subtitle') { echo get_the_subtitle($post->ID, '<p>', '</p>', false); } elseif (have_bootplate_subtitle('name') == 'kia-subtitle') { echo '<p>' . get_the_subtitle($post->ID) . '</p>'; } elseif (have_bootplate_subtitle('name') == 'secondary-title') { echo get_secondary_title($post->ID, '<p>', '</p>'); } }
echo get_permalink($post->ID); ?> "> <?php echo $img_html; ?> <?php echo $img_hidden; ?> <div class="block-text"> <?php if ($post->post_type != 'jobs') { // Jobs has not subtitle ?> <span class="overtext"><?php echo get_the_subtitle($ID); ?> </span> <?php } else { if ($post->post_type == 'jobs') { // Jobs has not subtitle ?> <span class="overtext <?php echo $extraclass; ?> "><?php echo get_the_title($ID); ?> </span> <?php
/** * Display subtitle column. * * @since 2.4 * * @param string $column_name Column name. * @param int $post_id Post ID */ public static function manage_subtitle_columns_content($column_name, $post_id) { if ($column_name == 'wps_subtitle') { echo get_the_subtitle($post_id, '', '', false); } }
get_header(); ?> <!-- Subhead ================================================== --> <header class="jumbotron subhead" id="overview"> <div class="container"> <?php get_template_part('breadcrumb'); ?> <?php // Get the page title $pid = is_home() ? get_option('page_for_posts') : false; $title = $pid ? get_the_title($pid) : __('Blog', 'adap'); $subtitle = function_exists('get_the_subtitle') && $pid ? get_the_subtitle($pid) : ''; ?> <!--h1><?php echo $title; ?> </h1--> <p class="lead"><?php echo $subtitle; ?> </p> </div> </header> <div class="container"> <div class="row">
function has_subtitle($id = 0) { $sb = get_the_subtitle($id); return !empty($sb); }
* * @package Chuchadon */ ?> <div class="loop-meta" <?php hybrid_attr('loop-meta'); ?> > <?php if (is_home() && !is_front_page()) { $chuchadon_archive_title = get_post_field('post_title', get_queried_object_id()); /* Support for Subtitles Plugin. */ if (function_exists('get_the_subtitle')) { $chuchadon_loop_desc = get_the_subtitle(get_queried_object_id()); } } elseif (is_404()) { $chuchadon_archive_title = __('Oops! That page can’t be found.', 'chuchadon'); $chuchadon_loop_desc = __('It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'chuchadon'); } elseif (is_search()) { /* Translators: %s is the search query. The HTML entities are opening and closing curly quotes. */ $chuchadon_archive_title = sprintf(__('Search results for “%s”', 'chuchadon'), get_search_query()); $chuchadon_loop_desc = sprintf(__('You are browsing the search results for “%s”', 'chuchadon'), get_search_query()); } elseif (is_author()) { $chuchadon_archive_title = get_the_archive_title(); $chuchadon_loop_desc = get_the_author_meta('description', get_query_var('author')); } elseif (is_post_type_archive('jetpack-testimonial')) { $jetpack_options = get_theme_mod('jetpack_testimonials'); $chuchadon_archive_title = $jetpack_options['page-title'] ? esc_html($jetpack_options['page-title']) : esc_html__('Testimonials', 'chuchadon'); $chuchadon_loop_desc = convert_chars(convert_smilies(wptexturize(stripslashes(wp_filter_post_kses(addslashes($jetpack_options['page-content']))))));