Buy All 47 Premium Themes For the Price Of $199.99

WP – Back To Top Button

Back To Top Button – Documentation

 

  

Back To Top Button adds a button that appears when visitors scroll down the page and smoothly takes them back to the top. Install and activate the plugin and the button works right away. All other settings are optional and can be changed in a settings page with a live preview.

Version: 2.0.0 · Requires WordPress 5.0+ and PHP 7.0+ · Made by SEOS Themes

Contents

  1. Installation
  2. Updating from version 1.x
  3. The settings page
  4. General
  5. Icon & Text
  6. Style
  7. Animation
  8. Position & Mobile
  9. Display rules
  10. Advanced & Tools
  11. Shortcode and custom links
  12. For developers
  13. FAQ

1. Installation

From the WordPress dashboard

  1. Go to Plugins → Add New.
  2. Search for Back to Top Button.
  3. Click Install Now, then Activate.

From a ZIP file

  1. Go to Plugins → Add New → Upload Plugin.
  2. Choose back-to-top-button.zip and click Install Now.
  3. Click Activate.

Via FTP

  1. Unzip the file and upload the back-to-top-button folder to wp-content/plugins/.
  2. Activate the plugin in Plugins.

After activation you will find Back To Top Button in the admin menu on the left. There is also a Settings link under the plugin name on the Plugins page.

2. Updating from version 1.x

Version 2.0 is fully compatible with 1.x. After the update your button looks and works exactly as before:

  • All old settings are kept: background color, button color, speed, border radius, position, opacity, width, height, font size, margins and the selected or uploaded image.
  • The button keeps the ID #totop, so any custom CSS you wrote for it still works.
  • The same Font Awesome arrow is shown.
  • Font Awesome and jQuery keep loading on every page like in 1.x, so nothing in your theme breaks.
  • The settings page has the same address: wp-admin/admin.php?page=seos-back-to-top-settings.
  • All new features are off until you turn them on.

Two old problems are also fixed automatically:

  • Bundled images keep working after you move the site to a new domain or to HTTPS.
  • Old versions sometimes saved the text “Set Color” instead of a color. This value is now ignored and the default color is used.

Tip: if your theme does not use Font Awesome or jQuery, go to Advanced & Tools and turn off Load Font Awesome 4 & jQuery (1.x compatibility). Then choose one of the built-in SVG icons in Icon & Text. Your pages will load faster.

3. The settings page

The settings are split into seven tabs. On the right side there is a Live preview:

  • Every change is shown in the preview immediately.
  • Use the Desktop / Mobile switch to see how the button looks on phones.
  • Move the Simulated scroll slider to see the progress ring at different scroll positions.

Nothing changes on your site until you click Save Changes. While there are unsaved changes, the text “You have unsaved changes” is shown next to the button.

4. General

Setting What it does Default
Enable button Turns the floating button on or off without losing your settings. On
Show after scrolling How far the visitor has to scroll before the button appears. Choose pixels or % of the page. 500 pixels
Scroll duration How long the scroll to the top takes, in milliseconds. 0 = jump instantly. Quick buttons: 250, 400, 700, 1000, 2000. 400 ms
Scroll effect (easing) How the movement feels: Swing (classic), Linear, Smooth in & out, Fast start soft stop, Very fast start, Back (small overshoot), Bounce, Browser native smooth scroll, Instant jump. Swing
Show only when scrolling up The button stays hidden while the visitor reads and appears when they start scrolling back up. Off
Auto-hide after Hides the button after this many seconds without scrolling. 0 = never hide. 0
Scroll to Top of the page or A specific element. Top of the page
Element selector The CSS selector of the element to scroll to, for example #masthead, .site-header or #content. –
Offset Stops this many pixels above the target. Useful with sticky headers. 0
Stop on user scroll If the visitor uses the mouse wheel or touches the screen during the animation, the animation stops. On
Respect “reduce motion” Visitors who turned on “reduce motion” in their operating system get an instant jump and no animations. On
Move keyboard focus to the top After scrolling, keyboard focus moves to the top of the page. Recommended for keyboard and screen reader users. On
Keyboard shortcut “T” Pressing the T key (outside of text fields) scrolls to the top. Off

5. Icon & Text

Button content

  • Icon – one of 14 built-in SVG icons: chevron, double chevron, arrow, long arrow, arrow to top, arrow in circle, chevron in circle, triangle, caret, bold arrow, pointing hand, rocket, home, paper plane. SVG icons are sharp on every screen and need no icon font.
  • Icon + text – an icon together with a label, for example “Top” or “Back to top”.
  • Text only – just a label.
  • Image – one of the 171 bundled images or your own image.
  • Font Awesome – any Font Awesome 4.7 icon.

Icon settings

Setting What it does
Icon Click an icon to choose it.
Icon size Size of the icon in pixels. Empty = same as the font size.
Line thickness Thickness of the SVG icon lines (0.5 – 5).
Font Awesome class Classes of a Font Awesome 4.7 icon, for example fa fa-arrow-up, fa fa-angle-double-up or fa fa-rocket. Font Awesome is loaded automatically when this type is selected.

Text settings

Setting What it does
Button text The label of the button. The default “Top” is translated automatically, for example to “Нагоре” on Bulgarian sites.
Layout Icon left / text right, text left / icon right, icon above text, text above icon.
Letter case As typed, UPPERCASE, lowercase, Capitalize.
Font weight From 300 (light) to 800 (extra bold).
Font Tahoma (as in 1.x), same as the theme, system UI, serif or monospace.

Image

  1. Choose Image as button content.
  2. Click one of the 171 Bundled icons, or click Upload / Media Library and choose your own image. You can also paste the URL of an image.
  3. Choose the Image size: original size (as in 1.x), fit inside the button, fill the button, or 70% of the button.
  4. Optional: set a Background behind the image. Empty = transparent.

Images with a transparent background (PNG or SVG) look best.

Accessibility

  • Screen reader label – the text read by screen readers. Default: “Back to top”.
  • Tooltip on hover – a small text shown when the mouse is over the button. Empty = no tooltip.

6. Style

Colors

Setting What it does Default
Background color Background of the button. #0094FF
Icon / text color Color of the icon and the text. #FFFFFF
Gradient background Turns the background into a gradient from the background color to the second color. Off
Second gradient color The second color of the gradient. #00D4FF
Gradient angle Direction of the gradient, 0 – 360°. 135°
Hover background Background when the mouse is over the button. Empty = no change. –
Hover icon / text color Icon and text color on hover. –
Opacity Transparency of the visible button, 0.05 – 1. 1
Opacity on hover Transparency when the mouse is over the button. 0.8

Color fields accept HEX (#ff0000), rgb(), rgba(), hsl(), hsla() and transparent.

Size & shape

Setting What it does Default
Width Width of the button in pixels. With text, this is the minimum width. 45 px
Height Height of the button in pixels. 45 px
Font / icon size Size of the text and the icon. 20 px
Corner radius Rounding of the corners. Quick buttons: Square, Rounded, Circle / pill. 0 px

Border & shadow

  • Border width, Border style (solid, dashed, dotted, double), Border color and Hover border color. The border is shown when the width is more than 0.
  • Shadow – none, small, medium, large or glow.
  • Shadow color – empty = automatic (dark for shadows, the background color for glow).
  • Glass effect (blur behind) – blurs the page behind the button. Works best with a semi-transparent background, for example rgba(0,0,0,0.3).

7. Animation

Appear / disappear

  • Animation – fade (as in 1.x), slide up, slide in from the side, zoom, flip or none.
  • Duration – how long the animation takes, in milliseconds. Default: 400.

Effects

  • Hover effect – only opacity (as in 1.x), lift up, grow, shrink, tilt, or icon moves up.
  • Attention animation – pulse ring, bouncing icon, shake or heartbeat. It repeats while the button is visible.

Scroll progress ring

A line around the button that fills up while the visitor reads the page. It follows the shape of the button, so it works with square, rounded, round and pill buttons.

  • Show progress – turns the ring on.
  • Progress color and Track color – color of the filled part and of the empty part.
  • Line width – 1 – 12 px.
  • Show percentage – shows the progress as a number (for example “45%”) inside the button. The icon appears on hover.

8. Position & Mobile

Position

Setting What it does Default
Position Left, center or right side of the screen. Right
Distance from bottom Space between the button and the bottom of the screen. 45 px
Distance from right / left Space from the side. Only the field for the chosen side is shown. 40 px
Layer (z-index) Raise it if the button is hidden behind a chat widget, cookie bar or sticky footer. 99999

Mobile

Empty fields use the desktop values. Use the Mobile switch of the preview to check the result.

  • Mobile up to – screens this wide or narrower count as mobile. Default: 768 px.
  • Hide on mobile / Hide on desktop.
  • Mobile width, Mobile height, Mobile font / icon size.
  • Mobile distance from bottom and Mobile distance from the side.
  • Hide text on mobile – shows only the icon on small screens.

9. Display rules

By default the button is shown on every page. You can hide it:

  • on the front page;
  • on the blog / posts page;
  • on single posts and pages;
  • on archives (categories, tags, authors, shop);
  • on search results;
  • on the 404 page;
  • for logged-in users;
  • for visitors who are not logged in.
Setting What it does
Hide on these IDs Post or page IDs separated by commas, for example 12, 45, 230.
Show ONLY on these IDs When filled, the button appears only on these posts and pages. Leave empty to show it everywhere.
Single items: only these post types Show the button on single items of the checked post types only (posts, pages, products…). Nothing checked = all post types.

How to find the ID of a page: open the page for editing. The ID is the number after post= in the address bar, for example post.php?post=45&action=edit.

10. Advanced & Tools

Advanced

Setting What it does
Custom CSS Your own CSS for the button. The button has the ID #totop. The plugin styles use !important, so add !important to your rules too.
Extra CSS class Adds your own class to the button.
Load Font Awesome 4 & jQuery (1.x compatibility) Version 1.x loaded Font Awesome and jQuery on every page. This option is on after an update from 1.x so nothing on your site changes, and off on new installations. Turn it off for a faster site if your theme does not use them.
Delete settings when the plugin is deleted When on, all settings are removed when you delete the plugin. When off (default), the settings are kept.

Example of custom CSS:

#totop {
	letter-spacing: 0.1em !important;
}
#totop:hover {
	background-color: #222 !important;
}

Export / Import / Reset

  • Export – click Download settings to save all settings as a JSON file. Use it as a backup or to copy the same button to another site.
  • Import – choose a JSON file exported from this plugin and click Import.
  • Reset – click Reset to defaults to restore every setting. This can not be undone, so export your settings first if you may need them again.

11. Shortcode and custom links

Shortcode

Add a “back to top” link anywhere in a post, a page or a widget:

[back_to_top]

With your own text and CSS class:

[back_to_top text="Back to the top" class="my-link"]
Attribute What it does Default
text The text of the link. Back to top
class Extra CSS classes for the link. –

The shortcode works even when the floating button is turned off or hidden on that page. It uses the same scroll duration and scroll effect.

Any element

Give any link or button the class bttb-scroll-top and it will scroll to the top when clicked:

<a href="#" class="bttb-scroll-top">Back to top</a>

In the block editor: select the block, open Advanced in the sidebar and type bttb-scroll-top in Additional CSS class(es).

12. For developers

Filters

Filter Description
bttb_settings Change the settings before they are used. Receives the array of all settings.
bttb_show_button Decide whether the floating button is shown on the current page. Receives $show (bool) and $settings.
bttb_button_html Change the HTML of the button. Receives $html and $settings.

Hide the button on WooCommerce checkout:

add_filter( 'bttb_show_button', function ( $show ) {
	if ( function_exists( 'is_checkout' ) && is_checkout() ) {
		return false;
	}
	return $show;
} );

Use a different color on a specific page:

add_filter( 'bttb_settings', function ( $settings ) {
	if ( is_page( 'contact' ) ) {
		$settings['bg_color'] = '#e63946';
	}
	return $settings;
} );

JavaScript

Scroll to the top from your own script:

window.bttbScrollTop();

HTML and CSS classes

Selector Description
#totop The floating button (same ID as in 1.x).
#totop.bttb-visible The button while it is visible.
.bttb-type-icon, .bttb-type-icon_text, .bttb-type-text, .bttb-type-image, .bttb-type-fa The selected button content.
.bttb-pos-left, .bttb-pos-center, .bttb-pos-right The selected position.
.bttb-icon, .bttb-text, .bttb-percent The icon, the text and the percentage inside the button.
.bttb-progress, .bttb-progress-bar, .bttb-progress-track The progress ring (SVG).

Stored options

Settings from 1.x are stored as separate options with the same names as before (back_to_top_background_color, back_to_top_button_color, back_to_top_button_speed, back_to_top_button_radius, back_to_top_option_position, back_to_top_button_load1, back_to_top_button_opacity, back_to_top_button_width, back_to_top_button_height, back_to_top_button_font_size, back_to_top_button_position_right, back_to_top_button_position_left, back_to_top_button_position_bottom). All new settings are stored in the option bttb_options.

Translations

Text domain: back-to-top-button. English and Bulgarian are included. A .pot template for other languages is in the languages folder.

13. FAQ

I updated from 1.x. Will my button change?

No. All old settings are kept and the button looks and works exactly as before. New features are off until you turn them on.

The button does not appear.

  • Check that Enable button is on.
  • Scroll further down. By default the button appears after 500 pixels. Very short pages may not be long enough.
  • Check Display rules, Hide on mobile, Hide on desktop and Show only when scrolling up.
  • If you use a caching plugin, clear the cache after saving.

The button is hidden behind a chat widget or a cookie bar.

Raise Layer (z-index) or change Distance from bottom in Position & Mobile.

My custom CSS does not work.

The plugin styles use !important so that themes can not break the button. Add !important to your own rules too.

The scroll is jerky.

Some themes add scroll-behavior: smooth. The plugin turns it off during its own animation, but you can also choose Browser native smooth scroll as scroll effect.

How can I make my site faster?

Turn off Load Font Awesome 4 & jQuery (1.x compatibility) in Advanced & Tools (if your theme does not use them) and use one of the built-in SVG icons.

Does it work with every theme?

Yes. The button works with any WordPress theme. If you are looking for a new theme, see the free and premium themes at SEOS Themes.

More from SEOS Themes

Fast, SEO-friendly WordPress themes for online stores, news, blogs, photographers, restaurants, real estate and more.