While working on my Gutenberg Editor Development Course I had a simple question early on: "How do I enqueue my block JavaScript and CSS to work with the Gutenberg Editor?" The short answer is there are two ways: enqueue_block_editor_assets - For enqueueing JavaScript and CSS in the admin editor only. enqueue_block_assets - Enqueues on both the frontend of the site … Continue reading How to Add JavaScript and CSS to Gutenberg Blocks the Right Way in Plugins and Themes
Tag: CSS
How to Deregister, Unqueue and Unhook a Parent Theme CSS Stylesheet
There comes a time when working with a WordPress project where you want to not include certain CSS from a parent theme or plugin. For example, a parent theme may include extra stylesheets that you don't want or a plugin may be adding styles that conflict with your site. On a recent project, I wanted to remove … Continue reading How to Deregister, Unqueue and Unhook a Parent Theme CSS Stylesheet
How to Load Conditional CSS The Right Way in WordPress
Big thanks to Micah Wood for his article showing how to load conditional stylesheets the right way via the functions.php file. Thanks Micah for the great post!
Slides From WordCamp Raleigh – Learn Web Design Via WordPress
The other week I had the great privilege of speaking at WordCamp Raleigh 2013. Here are my slides from the talk https://speakerdeck.com/zgordon/learn-web-design-via-wordpress
Adding CSS to WordPress Theme Via functions.php File
One of the incorrect way theme developers add their CSS to their theme is via the bloginfo('stylesheet_url'); tag in the header.php. This is a bad idea. A better way to do this is via the functions.php file, much in the same way you properly link to JavaScript files a WordPress theme. Here is the code … Continue reading Adding CSS to WordPress Theme Via functions.php File
style.css Comment Code for Twenty Twelve Theme
/* Theme Name: Twenty Twelve Theme URI: http://wordpress.org/extend/themes/twentytwelve Author: the WordPress team Author URI: http://wordpress.org/ Description: The 2012 theme for WordPress is a fully responsive theme that looks great on any device. Features include a front page template with its own widgets, an optional display font, styling for post formats on both index and single … Continue reading style.css Comment Code for Twenty Twelve Theme