示例#1
0
/** ENTRY META
 * Prints HTML with meta information for the categories, tags.
 *
 * @since Twenty Fifteen 1.0
 */
function twentyfifteen_entry_meta()
{
    if (is_sticky() && is_home() && !is_paged()) {
        printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen'));
    }
    $format = get_post_format();
    if (current_theme_supports('post-formats', $format)) {
        printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')), esc_url(get_post_format_link($format)), get_post_format_string($format));
    }
    $okArray = array('attachment', "post");
    $webcomicsPostType = get_webcomic_collections();
    foreach ($webcomicsPostType as $webcomic) {
        array_push($okArray, $webcomic);
    }
    if (in_array(get_post_type(), $okArray)) {
        $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
        if (get_the_time('U') !== get_the_modified_time('U')) {
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
        }
        $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
        printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'twentyfifteen'), esc_url(get_permalink()), $time_string);
    }
    if ('post' == get_post_type()) {
        if (is_singular() || is_multi_author()) {
            printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'twentyfifteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
        }
        $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen'));
        if ($categories_list && twentyfifteen_categorized_blog()) {
            printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'twentyfifteen'), $categories_list);
        }
        $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen'));
        if ($tags_list) {
            printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'twentyfifteen'), $tags_list);
        }
    }
    if (is_attachment() && wp_attachment_is_image()) {
        // Retrieve attachment metadata.
        $metadata = wp_get_attachment_metadata();
        printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>', _x('Full size', 'Used before full size attachment link.', 'twentyfifteen'), esc_url(wp_get_attachment_url()), $metadata['width'], $metadata['height']);
    }
    if (in_array(get_post_type(), $webcomicsPostType)) {
        if (is_singular() || is_multi_author()) {
            printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'twentyfifteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
        }
        $collection_list = WebcomicTag::get_the_webcomic_collection_list(0, "", __(', ', 'twentytwelve'));
        $id = get_the_ID();
        $storylineObj = wp_get_object_terms($id, get_post_type() . "_storyline");
        $isChild = false;
        $parentStory;
        foreach ($storylineObj as $storyline) {
            if ($storyline->parent != 0) {
                $isChild = true;
                $parentStory = get_term_by("id", $storyline->parent, get_post_type() . "_storyline");
            }
        }
        //var_dump($collection_list, $storylineObj, $isChild,$parentStory);
        if ($isChild) {
            $parentName = $parentStory->name;
            $storyline_list = WebcomicTag::get_the_webcomic_term_list(0, 'storyline', "<a href='" . get_term_link($parentStory) . "'>" . $parentName . "</a> &gt ", __(', ', 'twentytwelve'));
        } else {
            $storyline_list = WebcomicTag::get_the_webcomic_term_list(0, 'storyline', "", __(', ', 'twentytwelve'));
        }
        if ($collection_list && $storyline_list) {
            printf('<br><span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s > %3$s</span><br>', _x('Categories', 'Used before category names.', 'twentyfifteen'), $collection_list, $storyline_list);
        }
        $character_list = WebcomicTag::get_the_webcomic_term_list(0, 'character', '', __(', ', 'twentytwelve'));
        if ($character_list) {
            printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span><br>', _x('Tags', 'Used before tag names.', 'twentyfifteen'), $character_list);
        }
    }
    if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
        echo '<span class="comments-link">';
        comments_popup_link(__('Leave a comment', 'twentyfifteen'), __('1 Comment', 'twentyfifteen'), __('% Comments', 'twentyfifteen'));
        echo '</span>';
    }
}
示例#2
0
function webcomic2012_webcomic_meta()
{
    // Translators: used between list items, there is a space after the comma.
    $categories_list = WebcomicTag::get_the_webcomic_term_list(0, 'storyline', '<span class="webcomic-storylines">', __(', ', 'twentytwelve'), '</span>');
    // Translators: used between list items, there is a space after the comma.
    $tag_list = WebcomicTag::get_the_webcomic_term_list(0, 'character', '<span class="webcomic-characters">', __(', ', 'twentytwelve'), '</span>');
    $date = sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
    $author = sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('Veja todos os posts de %s', 'twentytwelve'), get_the_author())), get_the_author());
    $collection_list = WebcomicTag::get_the_webcomic_collection_list(0, '<span class="webcomic-collections">', __(', ', 'twentytwelve'), '</span>');
    // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    if ($tag_list) {
        $utility_text = __('Esta página possui roteiro e arte de %2$s para a história %1$s do %5$s. Publicada em %3$s<span class="by-author"> por %4$s</span>.', 'twentytwelve');
    } elseif ($categories_list) {
        $utility_text = __('Esta página faz parte da história %1$s do %5$s. Publicada em %3$s<span class="by-author"> por %4$s</span>.', 'twentytwelve');
    } else {
        $utility_text = __('Publicado em %3$s<span class="by-author"> por %4$s</span>.', 'twentytwelve');
    }
    printf($utility_text, $categories_list, $tag_list, $date, $author, $collection_list);
}
示例#3
0
文件: tags.php 项目: ecerta/webcomic
 /**
  * Return a formatted list of collections related to the current webcomic.
  * 
  * <code class="php">
  * // render a comma-separated list of collections related to the current webcomic
  * the_webcomic_collections();
  * 
  * // render an unordered list of collections related to the current webcomic
  * the_webcomic_collections( '<ul><li>', '</li><li>', '</li></ul>' );
  * 
  * // render links to the first webcomic in each collection related to the current webcomic with a small collection poster
  * the_webcomic_collections( '<div><h2>collections</h2><figure>', '</figure><figure>', '</figure></div>', 'first', 'thumbnail' );
  * </code>
  * 
  * <code class="bbcode">
  * // render a comma-separated list of collections related to the current webcomic
  * [the_webcomic_collections]
  * 
  * // render an unordered list of collections related to the current webcomic
  * [the_webcomic_collections before="<ul><li>" sep="</li><li>" after="</li></ul>"]
  * 
  * // render links to the first webcomic in each collection related to the current webcomic with a small collection poster
  * [the_webcomic_collections before="<div><h2>Storylines</h2><figure>" sep="</figure><figure>" after="</figure></div>" target="first" image="thumbnail"]
  * </code>
  * 
  * @package Webcomic
  * @param string $before Before list.
  * @param string $sep Separate items using this.
  * @param string $after After list.
  * @param string $target Where the collections links should point to, one of 'archive', 'first', 'last', or 'random'.
  * @param string $image Image size to use when displaying collection images for links.
  * @param mixed $crossover Whether to include crossover collections (true), exclude them (false), or include only them ('only').
  * @uses WebcomicTag::get_the_webcomic_collection_list()
  */
 function the_webcomic_collections($before = '', $sep = ', ', $after = '', $target = 'archive', $image = '', $crossover = true)
 {
     echo WebcomicTag::get_the_webcomic_collection_list(0, $before, $sep, $after, $target, $image, $crossover);
 }
示例#4
0
 /**
  * Handle the_webcomic_collections shortcode.
  * 
  * @param array $atts Shortcode attributes.
  * @return string
  * @uses WebcomicTag::get_the_webcomic_collection_list()
  */
 public function the_webcomic_collections($atts)
 {
     extract(shortcode_atts(array('id' => 0, 'before' => '', 'sep' => ', ', 'after' => '', 'target' => 'archive', 'image' => '', 'crossover' => true), $atts));
     return WebcomicTag::get_the_webcomic_collection_list($id, $before, $sep, $after, $target, $image, $crossover);
 }