Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace back to top icon with an image
add_filter( 'generate_back_to_top_output', 'tu_custom_back_to_top_icon' );
function tu_custom_back_to_top_icon() {
printf(
'<a title="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
<img src="URL TO YOUR IMAGE" alt="Back to top" />
<span class="screen-reader-text">%5$s</span>
</a>',
esc_attr__( 'Scroll back to top','generatepress' ),
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
esc_attr( apply_filters( 'generate_back_to_top_icon','fa-angle-up' ) ),
__( 'Scroll back to top','generatepress' )
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment