For example, when on the ‘widgets’ admin screen both draggable and droppable are already loaded (which provides the draggable interface for managing your sidebars / widgets) However it is often better to implicitly load the script you want just in case. WordPress often enqueues some of the interaction libraries in the administration areas. All you need to do is enqueue the required script on either the front end or back end of your site and you will be able to leverage the library however you want. WordPress comes pre-intstalled with all of the interactions libraries (such as draggable and droppable). Using these filters is useful if you need to enqueue styles/scripts that don’t depend on admin-bar, for example see a pull request for Site Kit which uses these filters to mark react and wp-api-fetch for Dev Mode.Loading the jQuery Interactions Libraries The AMP plugin recursively checks registered scripts and styles for a dependency on admin-bar and injects the data-ampdevmode attribute via the script_loader_tag and style_loader_tag filters, respectively. Similarly to enqueued styles, an enqueued script can also be marked for Dev Mode automatically by just registering it with a dependency on the admin-bar script in core: wp_enqueue_script( I noticed something unusual at the very end of a diff of the protoascii files: -6847,6 +6874,14 error_specificity ' ) Code language: PHP ( php ) Last month I was going through the recurring task of updating the plugin to the latest version of the AMP Validator specification. Not great!Īll of this is about to change with the release of the AMP plugin v1.3 (now available as release candidate). But again, it would unfortunately often get removed due to excessive CSS, and even when it was included it could be broken or functionally limited due to plugins’ JS being sanitized out of the page. In addition to the Admin Bar being important for normal site administration, it is also vital in an AMP context because the plugin adds an Admin Bar menu item to show the validation status, letting users know if markup was removed through sanitization to make the page valid AMP: Admin Bar on AMP page that has invalid markup being sanitized. These Admin Bar integrations would be largely broken on AMP pages or at least limited in functionality (as if JS is turned off in the browser, since the plugin removes custom scripts). Site Kit shows analytics for the current URL.Query Monitor displays performance and debugging information.Yoast SEO shows the page score along with notifications, alerts, and configuration links.Jetpack displays stats and notifications.Nevertheless, plugins also extend the Admin Bar with functionality which often requires JavaScript: As part of this, we had to fork core’s admin-bar.css to make it work with JavaScript turned off. In v1.2 the plugin was enhanced to eliminate this checkbox by automatically removing the Admin Bar when its CSS was too much for the 50KB limit on the page. In v1.0 the plugin restored the Admin Bar on AMP pages thanks in part to the CSS tree shaker, but still a checkbox was needed to turn off the Admin Bar when not enough CSS could be removed. When the AMP plugin first introduced theme support in v0.7, the Admin Bar was disabled entirely on AMP responses because of the 20KB+ of CSS that it adds to the page. This Admin Bar has been a challenge for the AMP plugin to accommodate, but this is now changing. The Admin Bar provides tools for administering a site, including links to create new posts, moderate comments, and access the Customizer. One standard component of WordPress pages is the Admin Bar (aka Toolbar) which appears on the frontend once a user has logged-in to the Admin. It does as much as possible to prevent serving invalid AMP pages, no matter what WordPress is outputting. The AMP plugin allows WordPress themes to be developed as usual and have their templates and stylesheets used to serve valid AMP pages. Tl dr In v1.3 the AMP plugin for WordPress no longer has to remove the Admin Bar to keep pages valid AMP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |