This week, the theme review team asked for feedback if custom blocks for the new editor should be allowed in themes that are hosted in the WordPress.org theme repo.
Continue reading "WordPress weekly recap #10: should custom blocks be allowed in W.org repo themes and more"Blog
Only apply CSS rules when JavaScript is disabled
Sometimes there is CSS that should only apply when JavaScript is disabled. The lazy loading plugin Lazy Loader, for example, hides the images with the lazyload
class, if JS is not active.
Until now I implemented that with a class that was added via JS to the html
or body
element. Without the class, the images are hidden, and if the class is present, the images are displayed.
Now the user wprox showed me an alternative solution in the W.org support forum, that he got from the article »Nice and easy lazy loading with lazysizes.js« by Steve McKinney: Simply put the styles for disabled JS into a noscript
element.
So instead of adding a class via JS to an element, and use that class in CSS to overwrite styles for disabled JavaScript, this is what it looks like in my plugin now:
<noscript>
<style>
.lazyload {
display: none;
}
</style>
</noscript>
Code language: HTML, XML (xml)
If you think about it, that is an obvious solution, but it never came to my mind before.
WordPress weekly recap #9: Gutenberg Plugin Compatibility Database and more
Daniel Bachhuber introduced a database that wants to provide information on compatibility with the Gutenberg editor for 5,000 plugins from the W.org directory.
Continue reading "WordPress weekly recap #9: Gutenberg Plugin Compatibility Database and more"Creating a WooCommerce product variation with the REST API
Like adding a product via the REST API is creating a product variation done relatively quickly – I use the PHP library for that, like in my last week’s post.
Continue reading "Creating a WooCommerce product variation with the REST API"WordPress weekly recap #8: localized login form on WordPress.org and more
The login and registration forms on login.wordpress.org are translatable now and should appear in your language.
Continue reading "WordPress weekly recap #8: localized login form on WordPress.org and more"Creating a WooCommerce product with PHP via the REST API
WooCommerce comes with a REST API that, for example, allows us to create products. Here I show you how to do this.
Continue reading "Creating a WooCommerce product with PHP via the REST API"WordPress weekly recap #7: block nesting in Gutenberg and more
This weeks Gutenberg release comes – among other things – with the ability of block nesting.
Continue reading "WordPress weekly recap #7: block nesting in Gutenberg and more"Create »svg« and »use« element with JavaScript
Creating SVG elements dynamically via JavaScript is not as easy as I thought… In this post, I show how to create an SVG element with JS, that displays a symbol via a use
element.
WordPress weekly recap #6: WordPress 4.9.3, 4.9.4 and more
This week there were two new releases for WordPress – the planned 4.9.3 version and the unplanned 4.9.4.
Continue reading "WordPress weekly recap #6: WordPress 4.9.3, 4.9.4 and more"Validating customize settings with displaying error messages
Since WordPress 4.6 it is relatively simple to add validation to customize settings, to give helpful error messages to the user. Here I show you how that works.
Continue reading "Validating customize settings with displaying error messages"