Making WordPress.org

Ticket #4565: 4565.diff

File 4565.diff, 1.2 KB (added by donmhico, 5 years ago)
  • wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-template.php

    diff --git wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-template.php wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-template.php
    index 26a164ef1..d0f11b121 100644
    function add_wordcamp_feed_link_to_head() { 
    656656        }
    657657}
    658658add_action( 'wp_head', 'add_wordcamp_feed_link_to_head', 4 ); // after feed_links_extra()
     659
     660/**
     661 * Include the year in Wordcamp Post Type <title> tag.
     662 *
     663 * @since WordCamp Post Type (0.1)
     664 *
     665 * @see `wp_title`
     666 * @link https://meta.trac.wordpress.org/ticket/4565
     667 * @global WP_Post $wcpt_template
     668 *
     669 * @param string $title
     670 * @param string $sep
     671 * @param string $sep_location
     672 * @return string
     673 */
     674function wcpt_wordcamp_wp_title_with_year( $title, $sep, $sep_location ) {
     675        global $post;
     676
     677        if ( WCPT_POST_TYPE_ID === $post->post_type ) {
     678                $title = wcpt_get_wordcamp_title( $post->ID ) . ' - ' . wcpt_get_wordcamp_start_date( $post->ID, 'Y' )
     679                        . ' ' . $sep . ' ';
     680        }
     681
     682        return $title;
     683}
     684add_filter( 'wp_title', 'wcpt_wordcamp_wp_title_with_year', 10, 3 );
     685 No newline at end of file