Make WordPress Core

Ticket #23852: 23852-quotes.diff

File 23852-quotes.diff, 2.8 KB (added by obenland, 11 years ago)
  • wp-content/themes/twentythirteen/content-quote.php

     
    1010
    1111<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1212        <div class="entry-content">
     13                <?php twentythirteen_the_quote(); ?>
    1314                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
    1415                <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    1516        </div><!-- .entry-content -->
  • wp-content/themes/twentythirteen/style.css

     
    17281728        color: #e63f2a;
    17291729}
    17301730
     1731.format-quote .quote-caption,
    17311732.format-quote .entry-content small,
    17321733.format-quote .entry-content cite {
    17331734        display: block;
     
    17351736        margin-top: 20px;
    17361737}
    17371738
    1738 .format-quote footer.entry-meta {
    1739         margin-top: 0;
     1739.format-quote .quote-caption small,
     1740.format-quote .quote-caption cite {
     1741        display: inline;
     1742        margin: auto;
    17401743}
    17411744
    17421745.format-quote .entry-meta .author {
  • wp-content/themes/twentythirteen/functions.php

     
    472472        return $atts;
    473473}
    474474
     475if ( ! function_exists( 'twentythirteen_the_quote' ) ) :
     476/**
     477 * Displays a quote based on post format meta data for quote post formats.
     478 *
     479 * @since Twenty Thirteen 1.0
     480 *
     481 * @return void
     482 */
     483function twentythirteen_the_quote() {
     484        $quote_meta = get_post_format_meta( get_the_ID() );
     485
     486        if ( empty( $quote_meta ) )
     487                return;
     488
     489        if ( ! empty( $quote_meta['quote'] ) && ! stristr( get_the_content(), $quote_meta['quote'] ) ) {
     490                $quote = sprintf( '<blockquote>%s</blockquote>', wpautop( $quote_meta['quote'] ) );
     491                if ( ! empty( $quote_meta['quote_source'] ) ) {
     492                        $source = ( ! empty( $quote_meta['url'] ) ) ?
     493                                sprintf( '<a href="%s">%s</a>', esc_url( $quote_meta['url'] ), $quote_meta['quote_source'] ) :
     494                                $quote_meta['quote_source'];
     495                        $quote .= sprintf( '<figcaption class="quote-caption">%s</figcaption>', $source );
     496                }
     497                $quote = sprintf( '<figure class="quote">%s</figure>', $quote );
     498        }
     499
     500        if ( isset( $quote ) )
     501                echo $quote;
     502}
     503endif;
     504
    475505/**
    476506 * Extends the default WordPress body class to denote:
    477507 * 1. Custom fonts enabled.