Changeset 3975
- Timestamp:
- 09/06/2016 03:04:41 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php
r3752 r3975 25 25 } 26 26 add_action( 'wp_footer', __NAMESPACE__ . '\inline_scripts' ); 27 28 function welcome_box() { 29 $welcome = get_page_by_path( 'welcome' ); 30 $cookie = 'welcome-' . get_current_blog_id(); 31 $hash = isset( $_COOKIE[ $cookie ] ) ? $_COOKIE[ $cookie ] : ''; 32 $content_hash = $welcome ? md5( $welcome->post_content ) : ''; 33 34 if ( $welcome && ( empty( $hash ) || $content_hash !== $hash ) ) : 35 $columns = preg_split( '|<hr\s*/?>|', $welcome->post_content ); 36 if ( count( $columns ) === 2 ) { 37 $welcome->post_content = "<div class='content-area'>\n\n{$columns[0]}</div><div class='widget-area'>\n\n{$columns[1]}</div>"; 38 } 39 setup_postdata( $welcome ); 40 41 // Disable Jetpack sharing buttons 42 add_filter( 'sharing_show', '__return_false' ); 43 ?> 44 <div class="make-welcome"> 45 <div class="entry-meta"> 46 <?php edit_post_link( __( 'Edit', 'o2' ), '', '', $welcome->ID ); ?> 47 <button type="button" id="make-welcome-hide" class="toggle dashicons dashicons-no" data-hash="<?php echo $content_hash; ?>" data-cookie="<?php echo $cookie; ?>" title="<?php esc_attr_e( 'Hide this message', 'p2-breathe' ); ?>"></button> 48 </div> 49 <div class="entry-content clear"> 50 <?php the_content(); ?> 51 </div> 52 </div> 53 <?php 54 remove_filter( 'sharing_show', '__return_false' ); 55 wp_reset_postdata(); 56 endif; 57 } 58 add_action( 'wporg_breathe_after_header', __NAMESPACE__ . '\welcome_box' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/header.php
r3974 r3975 1 1 <?php 2 $welcome = get_page_by_path( 'welcome' );3 $cookie = 'welcome-' . get_current_blog_id();4 $hash = isset( $_COOKIE[ $cookie ] ) ? $_COOKIE[ $cookie ] : '';5 $content_hash = $welcome ? md5( $welcome->post_content ) : '';6 7 2 $GLOBALS['pagetitle'] = get_bloginfo( 'name', 'display' ); 8 3 require WPORGPATH . 'header.php'; … … 24 19 </header><!-- .site-header --> 25 20 26 <?php 27 28 if ( $welcome && ( empty( $hash ) || $content_hash !== $hash ) ) : 29 $columns = preg_split( '|<hr\s*/?>|', $welcome->post_content ); 30 if ( count( $columns ) === 2 ) { 31 $welcome->post_content = "<div class='content-area'>\n\n{$columns[0]}</div><div class='widget-area'>\n\n{$columns[1]}</div>"; 32 } 33 setup_postdata( $welcome ); 34 35 // Disable Jetpack sharing buttons. 36 add_filter( 'sharing_show', '__return_false' ); 37 ?> 38 <div class="make-welcome"> 39 <div class="entry-meta"> 40 <?php edit_post_link( __( 'Edit', 'o2' ), '', '', $welcome->ID ); ?> 41 <button type="button" id="make-welcome-hide" class="toggle dashicons dashicons-no" data-hash="<?php echo $content_hash; ?>" data-cookie="<?php echo $cookie; ?>" title="<?php esc_attr_e( 'Hide this message', 'p2-breathe' ); ?>"></button> 42 </div> 43 <div class="entry-content clear"> 44 <?php the_content(); ?> 45 </div> 46 </div> 47 <?php 48 remove_filter( 'sharing_show', '__return_false' ); 49 wp_reset_postdata(); 50 endif; 51 ?> 21 <?php do_action( 'wporg_breathe_after_header' ); ?> 52 22 53 23 <div id="page" class="hfeed site">
Note: See TracChangeset
for help on using the changeset viewer.