Making WordPress.org

Changeset 6258


Ignore:
Timestamp:
12/11/2017 08:45:14 PM (8 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Set global post object to explanation post while obtaining explanation.

Negates need for explicitly decoding HTML entities in code blocks, which was also inadvertantly (and unnecessarily) being applied to REST API examples.

Fixes #3292.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/explanations.php

    r5843 r6258  
    5656        add_action( 'wp_ajax_new_explanation', array( $this, 'new_explanation'        )        );
    5757        add_action( 'wp_ajax_un_publish',      array( $this, 'un_publish_explanation' )        );
    58 
    59         // Content tweaks.
    60         add_filter( 'syntaxhighlighter_precode', 'html_entity_decode' );
    6158    }
    6259
     
    528525        }
    529526    }
     527
    530528}
    531529
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/reference/template-explanation.php

    r3796 r6258  
    1818        // Output the explanation. Passed through 'the_content' on retrieval, thus no escaping.
    1919        remove_filter( 'the_content', array( 'DevHub_Formatting', 'fix_unintended_markdown' ), 1 );
     20        global $post;
     21        $orig = $post;
     22        $post = get_explanation( get_the_ID() );
    2023        echo apply_filters( 'the_content', apply_filters( 'get_the_content', $explanation ) );
     24        $post = $orig;
    2125        add_filter( 'the_content', array( 'DevHub_Formatting', 'fix_unintended_markdown' ), 1 );
    2226        ?>
Note: See TracChangeset for help on using the changeset viewer.