Archived topic
Back to Top
7 replies · Started by mor on June 16, 2017
How do I replace the Back-to-Top button with an image (svg if possible)?
Thanks!
Hi there,
Pretty sure this is what you are looking for: https://docs.generatepress.com/article/generate_back_to_top_icon/
Let me know :)
If I want to use my own image, will the return be the url?
Actually try this instead: https://generatepress.com/forums/topic/modifying-scroll-back-to-top-button/#post-181987
Actually, you would do this:
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' )
);
}
Updated that link on gist too, thanks Leo. Overwriting functions is bad, filters are good :)
Thank you! I'm glad I could help :)
Thanks Tom :)