示例#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
 * @uses WebcomicTag::the_webcomic()
 * @uses WebcomicTag::webcomic_dropdown_transcript_terms()
 * @uses WebcomicTag::get_webcomic_transcript_authors()
 * @uses WebcomicTag::get_the_webcomic_transcript_term_list()
 * @uses is_webcomic()
 * @uses webcomic_prints_available()
 * @uses is_webcomic_archive()
 * @uses is_webcomic_storyline()
 * @uses is_webcomic_character()
 */
if (is_webcomic()) {
    global $post;
    if (webcomic_prints_available()) {
        $prints = array();
        $prints[] = WebcomicTag::webcomic_print_form("domestic", sprintf(__('%1$s%2$s%%total Domestic', "webcomic"), __("%dec.", "webcomic"), __("%sep,", "webcomic")));
        $prints[] = WebcomicTag::webcomic_print_form("international", sprintf(__('%1$s%2$s%%total International', "webcomic"), __("%dec.", "webcomic"), __("%sep,", "webcomic")));
        if (webcomic_prints_available("original")) {
            $prints[] = WebcomicTag::webcomic_print_form("original", sprintf(__('%1$s%2$s%%total Original', "webcomic"), __("%dec.", "webcomic"), __("%sep,", "webcomic")));
        }
        if ("_cart" === self::$config["collections"][$post->post_type]["commerce"]["method"]) {
            $prints[] = WebcomicTag::webcomic_print_form("cart");
        }
        $append .= "<div class='webcomic-prints'><style scoped>.webcomic-prints form{display:inline}</style><h2>" . __("Prints", "webcomic") . "</h2><div>" . implode("\n", $prints) . "</div></div><!-- .webcomic-prints -->";
    }
    $append .= WebcomicTag::webcomic_collection_link("<div class='webcomic-collection'>%link</div><!-- .webcomic-collection -->", "%title");
    $append .= WebcomicTag::get_the_webcomic_term_list($post->ID, 'storyline', '<div class="webcomic-storylines"><b>' . __("Part of ", "webcomic") . "</b>", ", ", "</div><!-- .webcomic-storylines -->");
    $append .= WebcomicTag::get_the_webcomic_term_list($post->ID, 'character', '<div class="webcomic-characters"><b>' . __("Featuring ", "webcomic") . "</b>", ", ", "</div><!-- .webcomic-characters -->");
    $append .= WebcomicTag::webcomic_dropdown_transcript_terms(array("before" => "<div class='webcomic-transcript-languages'>", "sep" => __(" | ", "webcomic"), "after" => "</div><!-- .webcomic-transcript-languages-->", "show_option_all" => __("- Transcript Language -", "webcomic"), "taxonomy" => "webcomic_language"));
} elseif (is_webcomic_archive() or is_webcomic_storyline() or is_webcomic_character() or is_search()) {
    $prepend = "<div class='integrated-webcomic'><div class='webcomic-img'>" . WebcomicTag::the_webcomic("medium", "self") . "</div><!-- .webcomic-img --></div><!-- .integrated-webcomic -->";
}
示例#3
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);
}
示例#4
0
文件: tags.php 项目: ecerta/webcomic
 /**
  * Render a formatted list of characters appearing to the current webcomic.
  * 
  * <code class="php">
  * // render a comma-separated list of characters appearing in the current webcomic
  * the_webcomic_characters();
  * 
  * // render an unordered list of characters appearing in the current webcomic
  * the_webcomic_characters( '<ul><li>', '</li><li>', '</li></ul>' );
  * 
  * // render links to the first appearance of each character appearing in the current webcomic with a small character avatar
  * the_webcomic_characters( '<div><h2>Characters</h2><figure>', '</figure><figure>', '</figure></div>', 'first', 'thumbnail' );
  * </code>
  * 
  * <code class="bbcode">
  * // render a comma-separated list of characters appearing to the current webcomic
  * [the_webcomic_characters]
  * 
  * // render an unordered list of characters appearing in the current webcomic
  * [the_webcomic_characters before="<ul><li>" sep="</li><li>" after="</li></ul>"]
  * 
  * // render links to the first appearance of each character appearing in the current webcomic with a small character avatar
  * [the_webcomic_characters before="<div><h2>characters</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 term links should point to, one of 'archive', 'first', 'last', or 'random'.
  * @param string $image Image size to use when displaying term images for links.
  * @param mixed $crossover Whether to include crossover characters (true), exclude them (false), or only include them ('only').
  * @uses WebcomicTag::get_the_webcomic_term_list()
  */
 function the_webcomic_characters($before = '', $sep = ', ', $after = '', $target = 'archive', $image = '', $crossover = true)
 {
     $taxonomy = 'character';
     if ('only' === $crossover) {
         $taxonomy = 'xcharacter';
     } elseif (!$crossover) {
         $taxonomy = '!character';
     }
     echo WebcomicTag::get_the_webcomic_term_list(0, $taxonomy, $before, $sep, $after, $target, $image);
 }
示例#5
0
 /**
  * Handle the_webcomic_(terms) shortcodes.
  * 
  * @param array $atts Shortcode attributes.
  * @param string $content Shortcode content.
  * @param string $name Shortcode name.
  * @return string
  * @uses WebcomicTag::get_the_webcomic_term_list()
  */
 public function the_webcomic_terms($atts, $content, $name)
 {
     extract(shortcode_atts(array('id' => 0, 'taxonomy' => 'storyline', 'before' => '', 'sep' => ', ', 'after' => '', 'target' => 'archive', 'image' => ''), $atts));
     if ('the_webcomic_storylines' === $name) {
         $taxonomy = 'storyline';
     } elseif ('the_webcomic_characters' === $name) {
         $taxonomy = 'character';
     }
     return WebcomicTag::get_the_webcomic_term_list($id, $taxonomy, $before, $sep, $after, $target, $image);
 }