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: Code
How to Send Emails in WordPress from the Functions.php
I have been working on a project that needs to occasionally send off emails. If you need to do so, here's how with wp_mail(): add_filter('wp_mail_content_type',create_function('', 'return "text/html"; ')); wp_mail('whoever@whatever.com', 'Subject', 'Message'); Thanks to WordPress Cheat Sheets for the code!
The Coolest WordPress Code Snippet Generator Ever
I am really impressed with Generate WP. It lets you use forms to easily configure exactly what you want to do in WordPress theme dev and then it outputs the code.
A Great Series on WordPress Coding Standards
Thanks to core contributor, Tom McFarlin, for writing up this great series of posts on WP Tuts+ dissecting the recommended coding standards for WordPress theme and plugin development. The WordPress Coding Standards: An Introduction The WordPress Coding Standards: Naming Conventions and Function Arguments The WordPress Coding Standards: Single Quotes and Double Quotes The WordPress Coding … Continue reading A Great Series on WordPress Coding Standards
Great Template Code for a WordPress Widget Plugin
Big thanks to Pippin from Pippin's Plugins for having the best code at the top of the search engines when I was looking for a WordPress widget template just like this. Thanks man!
How to Add the Site URL to the wp-config.php File
I find that adding the URL to the wp-config.php file helps when transferring a site from local to live production. define('WP_HOME', 'http://www.example.com'); // no trailing slash define('WP_SITEURL', 'http://www.example.com'); // no trailing slash