Ticket #23225: class-wp-customize-manager.php.patch
File class-wp-customize-manager.php.patch, 1.7 KB (added by , 12 years ago) |
---|
-
class-wp-customize-manager.php
333 333 add_action( 'wp_head', array( $this, 'customize_preview_base' ) ); 334 334 add_action( 'wp_head', array( $this, 'customize_preview_html5' ) ); 335 335 add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); 336 add_action( 'wp_footer', array( $this, 'customize_preview_base_hash_url_fix' ), 20 ); 336 337 add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 ); 337 338 add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) ); 338 339 … … 349 350 * @since 3.4.0 350 351 */ 351 352 public function customize_preview_base() { 352 ?><base href="<?php echo home_url( '/' ); ?>" /><?php353 ?><base id="wp-customize-preview-base" href="<?php echo home_url( '/' ); ?>" /><?php 353 354 } 354 355 355 356 /** 357 * Print script to allow hash URLs to work as expected 358 * 359 * @since 3.8 360 */ 361 public function customize_preview_base_hash_url_fix() { 362 ?><script>(function(){ 363 var wp_base = document.getElementById( 'wp-customize-preview-base' ), 364 a_tags = document.getElementsByTagName( 'a' ), 365 i, j, a_tag, attr; 366 367 if ( wp_base ) { 368 for ( i = 0; i < a_tags.length; i++ ) { 369 a_tag = a_tags[i]; 370 for ( j = 0; j < a_tag.attributes.length; j++ ) { 371 attr = a_tag.attributes[j]; 372 if ( attr.nodeName === 'href' && attr.nodeValue.charAt(0) === '#' ) { 373 attr.nodeValue = document.location.href + attr.nodeValue; 374 } 375 } 376 } 377 } 378 379 })(); 380 </script><?php 381 } 382 383 /** 356 384 * Print a workaround to handle HTML5 tags in IE < 9 357 385 * 358 386 * @since 3.4.0