Making WordPress.org


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.