WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/07/2016 06:04:37 AM (3 years ago)
Author:
pento
Message:

Breathe: Simplify the welcome message.

The welcome message is now two columns. Instead of requiring hard coded HTML in the page, it now just requires a <hr> to split the columns, so the page can be safely editing in the visual editor.

Fixes #1803.

File:
1 edited

Legend:

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

    r3630 r3631  
    2727$hash = isset( $_COOKIE[ $cookie ] ) ? $_COOKIE[ $cookie ] : '';
    2828
    29 if ( $welcome && md5( $welcome->post_content ) !== $hash ) {
     29$content_hash = $welcome ? md5( $welcome->post_content ) : '';
     30
     31if ( $welcome && ( empty( $hash ) || $content_hash !== $hash ) ) {
     32    $columns = preg_split( '|<hr\s*/?>|', $welcome->post_content );
     33    if ( count( $columns ) === 2 ) {
     34        $welcome->post_content = "<div class='first-column'>\n\n{$columns[0]}</div><div class='second-column'>\n\n{$columns[1]}</div>";
     35    }
    3036    setup_postdata( $welcome );
    3137?>
    3238<div class="make-welcome-wrapper">
    33     <span id="make-welcome-hide" class="dashicons dashicons-no" data-hash="<?php echo md5( $welcome->post_content ); ?>" data-cookie="<?php echo $cookie; ?>" title="<?php _e( 'Hide this message', 'p2-breathe' ); ?>"></span>
     39    <span id="make-welcome-hide" class="dashicons dashicons-no" data-hash="<?php echo $content_hash; ?>" data-cookie="<?php echo $cookie; ?>" title="<?php _e( 'Hide this message', 'p2-breathe' ); ?>"></span>
    3440    <div class="make-welcome">
    3541        <?php
Note: See TracChangeset for help on using the changeset viewer.