Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace back to top icon with an image
if ( ! function_exists( 'generate_back_to_top' ) ) :
/**
* Build the back to top button
*
* @since 1.3.24
*/
add_action( 'wp_footer','generate_back_to_top' );
function generate_back_to_top()
{
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
if ( 'enable' !== $generate_settings[ 'back_to_top' ] )
return;
$scroll_speed = apply_filters( 'generate_back_to_top_scroll_speed', 400 );
$start_scroll = apply_filters( 'generate_back_to_top_start_scroll', 300 );
?>
<a title="<?php _e( 'Scroll back to top','generatepress' ); ?>" rel="nofollow" href="#" class="generate-back-to-top" style="display:none;" data-scroll-speed="<?php echo $scroll_speed; ?>" data-start-scroll="<?php echo $start_scroll; ?>">
<img src="URL TO YOUR IMAGE" alt="" />
</a>
<?php
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment