<?php $image_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'thumbnail'); ?> <div class="header-team-img" data-bg="<?php echo $image_url[0]; ?> "></div> <?php } elseif ('case' === get_post_type(get_the_ID())) { $terms = wp_get_post_terms(get_the_ID(), 'cases'); ?> <span class="article-subtitle"><?php if (!empty($terms)) { echo $terms[0]->name; } ?> </span> <?php the_title('<h1 class="article-title">', '</h1>'); } else { ?> <?php if (has_subtitle()) { the_subtitle('<span class="article-subtitle">', '</span>'); } ?> <?php the_title('<h1 class="article-title">', '</h1>'); } ?> </header>
/** * 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'); }