WordPress.org

Making WordPress.org

Changeset 4827


Ignore:
Timestamp:
01/29/2017 01:06:41 PM (18 months ago)
Author:
ocean90
Message:

Breathe: Ensure correct context for the_content filters.

Fixes the welcome box on core component pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php

    r4826 r4827  
    7676
    7777function welcome_box() {
     78    global $post;
     79
    7880    $welcome = get_page_by_path( 'welcome' );
    7981    $cookie  = 'welcome-' . get_current_blog_id();
     
    8688            $welcome->post_content = "<div class='content-area'>\n\n{$columns[0]}</div><div class='widget-area'>\n\n{$columns[1]}</div>";
    8789        }
     90
     91        $post_backup = $post;
     92        $post = $welcome; // setup_postdata() doesn't update the global, do it manually to ensure correct context for `the_content` filters.
    8893        setup_postdata( $welcome );
    8994
     
    103108        remove_filter( 'sharing_show', '__return_false' );
    104109        wp_reset_postdata();
     110        $post = $post_backup;
    105111    endif;
    106112}
Note: See TracChangeset for help on using the changeset viewer.