Making WordPress.org

Ticket #1671: 1671.4.patch

File 1671.4.patch, 3.3 KB (added by DrewAPicture, 10 years ago)

But wait, there's more!

  • inc/extras.php

     
    9696 * @return string
    9797 */
    9898function wporg_filter_archive_excerpt( $excerpt ) {
    99         if ( ! is_single() && ! wporg_is_handbook() ) {
     99        $wporg_is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false;
    100100
     101        if ( ! is_single() && ! $wporg_is_handbook ) {
     102
    101103                $post_id = get_the_ID();
    102104                $type    = get_post_type_object( get_post_type( $post_id ) )->labels->singular_name;
    103105
  • inc/redirects.php

     
    3232         * Redirects a search query with only one result directly to that result.
    3333         */
    3434        public static function redirect_single_search_match() {
    35                 if ( is_search() && ! wporg_is_handbook() && 1 == $GLOBALS['wp_query']->found_posts ) {
     35                $wporg_is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false;
     36
     37                if ( is_search() && ! $wporg_is_handbook && 1 == $GLOBALS['wp_query']->found_posts ) {
    3638                        wp_redirect( get_permalink( get_post() ) );
    3739                        exit();
    3840                }
  • inc/search.php

     
    4343
    4444                // Separates searches for handbook pages from non-handbook pages depending on
    4545                // whether the search was performed within context of a handbook page or not.
    46                 if ( wporg_is_handbook() ) {
     46                $wporg_is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false;
     47
     48                if ( $wporg_is_handbook ) {
    4749                        // Search only in current handbook post type.
    4850                        // Just to make sure. post type should already be set.
    4951                        $query->set( 'post_type', wporg_get_current_handbook() );
  • inc/user-content.php

     
    6262         */
    6363        public static function scripts_and_styles() {
    6464                if ( is_singular() ) {
    65                         if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || wporg_is_handbook_post_type() ) {
     65                        $is_handbook_post_type = function_exists( 'wporg_is_handbook_post_type' ) ? wporg_is_handbook_post_type() : false;
     66
     67                        if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || $is_handbook_post_type ) {
    6668                                wp_enqueue_script( 'wporg-developer-function-reference', get_template_directory_uri() . '/js/function-reference.js', array( 'jquery', 'syntaxhighlighter-core', 'syntaxhighlighter-brush-php' ), '20150319', true );
    6769                                wp_enqueue_style( 'syntaxhighlighter-core' );
    6870                                wp_enqueue_style( 'syntaxhighlighter-theme-default' );
  • searchform.php

     
    3434<?php } ?>
    3535
    3636        <?php
    37                 $is_handbook = wporg_is_handbook();
     37                $is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false;
    3838                $search_url  = $is_handbook ? wporg_get_current_handbook_home_url() : home_url( '/' );
    3939                $form_class  = $is_handbook ? ' searchform-handbook' : '';
    4040        ?>