sprintf(__("%s Transcripts", "webcomic"), the_title("", "", false)); ?> </h3> <?php foreach ($transcripts as $post) { setup_postdata($post); ?> <div class="webcomic-transcript-content"><?php the_content(); ?> </div> <div class="webcomic-transcript-meta"> <?php printf(__('Transcribed by %1$s%2$s', "webcomic"), WebcomicTag::get_webcomic_transcript_authors(), WebcomicTag::get_the_webcomic_transcript_term_list(0, "webcomic_language", __(" in ", "webcomic"), __(", ", "webcomic"), __("", "webcomic"))); ?> </div> <?php wp_reset_postdata(); } } if (webcomic_transcripts_open()) { if (have_webcomic_transcripts(true) and $transcripts = get_webcomic_transcripts(true)) { foreach ($transcripts as $transcript) { webcomic_transcript_form(array(), $transcript); } } webcomic_transcript_form(); }
/** * Return a webcomic transcripts link. * * @param string $format Format string for the link. Should include the %link token, which will be replaced by the actual link. * @param string $none Format string for the link text when no transcripts have been published. Accepts %title and image size tokens. * @param string $some Format string for the link text when one or more transcripts have been published. Accepts %title and image size tokens. * @param string $off Format string for the link text when transcription has been disabled. Accepts %title and image size tokens. * @param mixed $language The language object or ID that transcripts should be limited to. * @param mixed $the_post The post object or ID to get a transcript link to. * @return string * @filter string webcomic_transcripts_link Filters the output of `webcomic_transcripts_link`. */ public static function webcomic_transcripts_link($format, $none = '', $some = '', $off = '', $language = false, $the_post = false) { if ($the_post = get_post($the_post) and $href = self::get_webcomic_transcripts_link($language, $the_post)) { $class = array('webcomic-transcript-link', "{$the_post->post_type}-transcript-link"); if (!webcomic_transcripts_open()) { $link = $off ? $off : __('Transcription Off', 'webcomic'); } elseif (have_webcomic_transcripts()) { $link = $some ? $some : __('View %title Transcripts', 'webcomic'); } else { $link = $none ? $none : __('Transcribe %title', 'webcomic'); } if (false !== strpos($link, '%')) { $tokens = array('%date' => mysql2date(get_option('date_format'), $the_post->post_date), '%title' => apply_filters('the_title', $the_post->post_title, $the_post->ID)); foreach (array_merge(get_intermediate_image_sizes(), array('full')) as $size) { if (false !== strpos($link, "%{$size}")) { $attachments = empty($attachments) ? self::get_attachments($the_post->ID) : $attachments; if (!$attachments) { break; } else { $image = ''; foreach ($attachments as $attachment) { $image .= wp_get_attachment_image($attachment->ID, $size); } $tokens["%{$size}"] = $image; } } } $link = str_replace(array_keys($tokens), $tokens, $link); } $link = '<a href="' . $href . '" class="' . implode(' ', $class) . '">' . $link . '</a>'; $format = str_replace('%link', $link, $format); return apply_filters('webcomic_transcripts_link', $format, $link, $the_post); } }