Teleporter brings smooth SPA-like (Single Page Application) transitions to your WordPress site. External links work as normal, but new pages on the same site are faded in magically when they are loaded and pages that have already been visited are instantly faded back in without needing to reload.
- Upload plugin .zip file to the
/wp-content/plugins/directory and unzip.
- Activate the plugin through the ‘Plugins’ menu in the WordPress Admin
How do I get started?
Once you have activated the plugin, any internal links on your site will automatically be loaded via page transitions. Visit the plugin settings page to modify the default plugin behaviour.
How does it work?
Teleporter loads new content in iframes within the existing window, then uses the Browser History API to keep track of the content that is loaded. It then monitors the
onpopstateevent so that browser forward and back buttons continue to load the desired content, with the added ability to fade between them.
<a>link on the page that:
- Does not have a link target attribute set.
- Does not have an onclick attribute already explicitly set.
- Does not have a class of
no-teleporter(or other specified classes.)
- Does not have an URL starting with
- Does not have an URL starting with the current Site URL.
- Does not have an URL with a hostname matching the current page.
- Does not have an URL containing
- Does not have an attribute of
- Is not in the Admin Bar (any link within the
This is a comprehensive attempt to match and transition between internal links only. (If you think there is something missing here please open a Github issue.)
As of 1.0.4, Teleporter will also handle dynamic link content. That is, links added to the page later. Simply specify the classes of these links on the plugin settings page, and they are then handled with click event delegation (instead of being directly adding to the
alink.) So for example, if you have a mobile menu that creates links upon expanding it with a
.mobile-linkclass, you can add
Similarly, if there are links that you wish to force to not transition for some reason, you can use the setting for ignore link classes in the same way. And, if you need to use selectors other than classes for these links, you can use the filters
teleporter_ignore_selectorsto add those respectively also.
Can I ensure fresh copies of certain pages are loaded?
As of 1.0.8, Teleporter includes a setting where you can specify pages (by slug or ID) to always refresh when clicked they are clicked through to.
This means that if a page already has been loaded in a Teleporter page session, and is switched away from, when it is switched back to, it is reloaded instead of simply switched back to.
Intended for use with cart or checkout pages. For example, if a customer visits their cart, then navigates away and adds another product, then switches back to the cart, the cart should be refreshed to show the new contents.
Note if there are other non-page URLS (eg. archives) where you want to force refresh also you can set the
teleporter_refreshfilter to true for that condition.
Will it break other scripts?
No. Unlike similar plugins or libraries that use AJAX to retrieve new content and swap it on the current page, Teleporter uses iframes. This may seem a little counter-intuitive since iframes have been around forever and AJAX would seem to be the modern tool for the job. However, loading page content in an iframe means that any scripts loaded within that iframe are correctly loaded by the browser without fail. Using AJAX, there is a risk that the scripts in the current page and the new page are different, which could cause breakage as the new page’s scripts are not initialized along with the content, and AJAX page transitioning does not (and cannot) address this issue.
How do I conflict test this?
How do I debug the script?
You can run Teleporter in debug mode by appending
teleporter.dev.jsfor testing purposes, you can reprocess that file into minified and unminified versions and debug simultaneously with
Người đóng góp & Lập trình viên
“Teleporter” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.Những người đóng góp
Nhật ký thay đổi
- Added: setting for pages to always refresh (plus filter)
- Fixed: history pop state mismatch after multiple clicks
- Updated: Plugin Panel (1.2.9)
- Updated: WordQuest Library (1.8.2)
- Fixed: add extra onclick function for iPhone event bubbling
- Improved: added checks to not load for admin/previews/editing modes
- Added: filter to allow for non-class ignore/dynamic selectors
- Fixed: dynamic link event bubbling on iPhone (via cursor:pointer)
- Fixed: method of adding of comment-reply-link ignore class
- Hotfix: automatically load dynamic link check
- Updated: Plugin Panel (1.2.8)
- Improved: add link event handlers instead of onclicks
- Added: dynamic link class click event handling option
- Updated: Plugin Panel (1.2.2)
- Fixed: (properly) not countable warning on ignore link classes
- Fixed: ignore comment reply link filter function name
- Fixed: not countable warning on ignore link classes
- Added: filter to ignore comment reply link classes
- Improved: also ignore mailto and tel links
- Added: Plugin Panel (1.2.0)
- Added: Teleporter Configuration Settings
- Added: Page Load Timeout to auto-transition
- Improved: Match timeout to loading bar animation
- Improved: Streamlined link checking function
- Improved: ignore links containing wp-login.php
- Fixed: check for external links by prefix, host and site URL
- Fixed: scrollbars on backward and forward history clicks
- Initial Release Version
- Fixed: added missing escape wrappers to plugin output
- Fixed: use unminified script for debug mode via querystring
- Initial Submission Version
- Fixed: ignore WordPress Admin Bar links
- Improved: added script minification
- Initial Working Version