View Categories

Back Button Widget: Shortcodes Guide

Back Button Anywhere Widget for WordPress registers two shortcodes you can use anywhere on your WordPress site: [alg_back_button] to output the button, and [alg_back_button_translate] to show language-specific text. Both are available in the free version.

Back Button Widget shortcode used on a WordPress page

Menu and floating buttons are not shortcodes. There is no [alg_back_button_menu] or [alg_back_button_floating] tag. Menu placement and the floating button are Pro settings under WPFactory > Back Button, in the Menu Options and Floating Button Options sections.

[alg_back_button] #

Outputs a “Back” control that returns the visitor to the previous page. Use it in posts, pages, widgets, or template files.

[alg_back_button label="Go back"]

Attributes:

Attribute Default Effect
label Back Button text.
type input input = a form button, simple = a text link, href = returns the bare javascript:history.back() URL for use in a link.
class Empty Extra CSS class(es) on the button.
style Empty Inline CSS, for example background-color:#007BFF;color:#fff;
js_func back back runs history.back(), go runs history.go(-1). Both go back one page.
fa Empty Font Awesome class, for example fas fa-angle-double-left. Setting this renders the button as a simple text link with the icon.
fa_template %icon% Where the icon sits. Use %icon% Back to show icon plus text.
before Empty Text or HTML added before the button.
after Empty Text or HTML added after the button.
lang Empty Language code(s). Used with not_lang_text to swap the label off that language.
not_lang_text Empty Label shown when the active language is not in lang.

Example with an icon and inline style:

[alg_back_button label="Go Back" fa="fas fa-arrow-left" fa_template="%icon% %label%" style="padding:10px 20px;"]

Back Button Widget shortcode with a Font Awesome icon

[alg_back_button_translate] #

Shows different text depending on the active site language (WPML or Polylang, read from ICL_LANGUAGE_CODE). It has two forms.

Self-closing form needs all three of lang, lang_text, and not_lang_text:

[alg_back_button_translate lang="FR" lang_text="Retour" not_lang_text="Back"]

Enclosing form wraps the text and shows it only for the matching language, or for everything except an excluded list:

[alg_back_button_translate lang="FR"]Retour[/alg_back_button_translate]
[alg_back_button_translate lang="DE"]Zurück[/alg_back_button_translate]
[alg_back_button_translate not_lang="FR,DE"]Back[/alg_back_button_translate]

Because [alg_back_button] runs shortcodes inside its label, you can combine the two: put a translate shortcode in the label to localize the button text. See How to translate the back button for full examples.

Get more control #

The shortcodes are free. Back Button Anywhere Widget for WordPress Pro adds the button to your menus, a floating button, and hide/show rules, all from the settings screen. See what Pro unlocks.

 

Back Button Widget for WordPress