WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/07/2016 05:03:29 AM (4 years ago)
Author:
pento
Message:

Breathe: Make the Welcome message dismissable.

It will re-appear if the content is changed, so folks will see updates.

Fixes #1804.

File:
1 edited

Legend:

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

    r3599 r3630  
    1313
    1414        <nav id="site-navigation" class="navigation-main clear" role="navigation">
    15             <div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'p2-breathe' ); ?>"><?php _e( 'Skip to content', 'p2-breathe' ); ?></a></div>
     15            <div class="screen-reader-text skip-link"><a href="#content" title="<?php _e( 'Skip to content', 'p2-breathe' ); ?>"><?php _e( 'Skip to content', 'p2-breathe' ); ?></a></div>
    1616
    1717            <?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => false ) ); ?>
     
    2323$welcome = get_page_by_path( 'welcome' );
    2424
    25 if ( $welcome ) {
     25$cookie = 'welcome-' . get_current_blog_id();
     26
     27$hash = isset( $_COOKIE[ $cookie ] ) ? $_COOKIE[ $cookie ] : '';
     28
     29if ( $welcome && md5( $welcome->post_content ) !== $hash ) {
    2630    setup_postdata( $welcome );
    2731?>
    28 <div class="make-welcome-wrapper"><div class="make-welcome">
    29     <?php
    30     the_content();
    31     edit_post_link( __( 'Edit', 'o2' ), '<p class="make-welcome-edit">', '</p>', $welcome->ID );
    32     ?>
    33 </div></div>
     32<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>
     34    <div class="make-welcome">
     35        <?php
     36        the_content();
     37        edit_post_link( __( 'Edit', 'o2' ), '<p class="make-welcome-edit">', '</p>', $welcome->ID );
     38        ?>
     39    </div>
     40</div>
    3441<?php
    3542    wp_reset_postdata();
Note: See TracChangeset for help on using the changeset viewer.