public
Last active

WordPress Theme Raindrops 1.008 has bug Please replace raindrops_small_device_helper function

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
/*
* Raindrops 1.008 can not remove custom header image.
*
* WordPress Theme Raindrops 1.008 has bug Please replace raindrops_small_device_helper function
* functions.php
*/
 
 
if ( ! function_exists( 'raindrops_small_device_helper' ) ) {
function raindrops_small_device_helper(){
global $is_IE, $raindrops_fluid_maximum_width;
 
// $raindrops_header_image_uri = get_header_image();
$raindrops_header_image = get_custom_header();
$raindrops_header_image_uri = $raindrops_header_image -> url;
if( empty( $raindrops_header_image_uri ) ){
/* when restore image $raindrops_header_image -> url is empty */
$raindrops_header_image_uri = get_header_image();
}
$raindrops_header_image_width = $raindrops_header_image -> width;
$raindrops_header_image_height = $raindrops_header_image -> height;
?>
<script type="text/javascript">
(function(){
jQuery(function(){
var width = jQuery('div#header-image').width();
function raindrops_resizes(){
var image_exists = '<?php echo $raindrops_header_image_uri;?>';
var width = jQuery('div#header-image').width();
var window_width = jQuery(window).width();
<?php
$raindrops_restore_check = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
if( $raindrops_restore_check !== 'remove-header' ){
$ratio = $raindrops_header_image_height / $raindrops_header_image_width;
?>
var ratio = <?php echo $ratio;?>;
var height = width * ratio;
jQuery('#header-image').removeAttr('style').css({'background-image':'url('+ image_exists + ')','height': height, 'background-size': 'cover'});
<?php //remove header
}
/**
* Check window size and mouse position
* Controll childlen menu show right or left side.
*
*
*
*/
?>
if ( jQuery('body > div').is('#doc3') ) {
jQuery("#access").mousemove(function(e){
var menu_item_position = e.pageX ;
 
if( window_width - 200 < menu_item_position){
jQuery('#access ul ul ul').addClass('left');
}else if( window_width / 2 > menu_item_position){
jQuery('#access ul ul ul').removeClass('left');
}
});
if( window_width > <?php echo $raindrops_fluid_maximum_width;?>){
//centering page when browser width > $raindrops_fluid_maximun_width
jQuery('#doc3').css({'margin':'auto'});
}
}
}
raindrops_resizes();
jQuery(window).resize( function () {raindrops_resizes()});
});
})(jQuery);
</script>
<?php
}
}

restore image submit then can not show default image.

reason $raindrops_header_image -> url return empty string.

if( get_header_image() !== false) check works improperly.

then change code.

$raindrops_restore_check = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );

if( $raindrops_restore_check !== 'remove-header' ){ ....

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.