How do we customize WordPress? How do we make themes our own and add functionality that is not part of a theme or that you want to use regardless of the theme you have installed? This post will explore the basics of creating custom WordPress elements and will cover plugins, child themes, and custom themes. Note The specifics of your situation will be different than mine. You should always analyze your needs and requirements before making a decision. Planning The first thing to do when planning to add things to a theme is to decide what's the best alternative to...
Third-party scripts on your site present a potentially dangerous side effect. We don't know what additional assets third-party load. That has security and performance implications. This post will look at the performance side of the issue. As Simon Hearne writes in How to Find the Third-Parties on Your Sitehttps://simonhearne.com/2015/find-third-party-assets/ using third party scripts that, in turn, make calls to additional sites and parties outside their and your control can affect the performance of your site. Quoting the post: > I ran the homepage through WebPageTest and sure enough, there were a bunch of calls to various subdomains of facebook.com. Thankfully...
Quotebacks are an interesting way to cite content from other websites. They work in two stages. Installing the extension and getting the quotations The first one is HTML formatted with special data attributes, a footer and a link to the script. There are browser extensions to create this code, one for Chrome and one for Firefox currently under development. Once the extension is installed, go to a page, select text and press command + shift + S on Mac and control + shift + S on Windows !The result of highlighting text and pressing command/control + shift + S to...
In 1987 Apple released this concept video of what they called a Network Navigator, an integrated agent to manage data from different sources, communicate with people across the network, and share information regardless of the source and its location. It may seem quaint to us now, 30 years later but the real question is whether the tools have evolved to the point where it is possible to build such technology. This post will explore some of the current technologies that would make such a project feasible and discuss potential future implementations. This is a theoretical exploration rather than a working...
In the not too distant future, WordPress will have lazy loading by default in WordPress corehttps://make.wordpress.org/core/2020/01/29/lazy-loading-images-in-wordpress-core/ enabled by default. I believe that this will be merged into WordPress core for the 5.5 release; until then, development is done on a feature pluginhttps://wordpress.org/plugins/wp-lazy-loading/ for people to continue working on it. But the problem is that this is enabled by default. As with many of the later decisions by the WordPress core team, this is good for beginners but I can think of at least two instances where lazy loading is not what I want to use: - Header images at the...
There are times when we need to add scripts to the page that will run only when there is a script already enqueued and loaded before it happens. I got bit by this when trying to use FontFaceObserver. For some reason, it worked fine in development but it would give a FontFaceObserver is not defined error when I moved the theme to production. The solution was hidden in some older documentation. As of version 4.5 there is an additional script loading function for loading inline scripts: wpaddinlinescript. This function allows adding inline scripts that depend on scripts The only important...
Node has had experimental support for EcmaScript moduleshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules for a while. Again, this is one thing I've wanted to explore for a while but have never felt the need to dig deeper. After all, it is experimental and it hasn't been approved for production use. But wit the release of Node 14 we're coming to the point when module support moved to stable. So let's explore what it takes to run ES Modules in Node on their own and together with current Node modules. What will Node consider an ES Module? There are certain file extensions and conditions that will...
Internationalizing a plugin After setting up the text domain in your plugin metadata we need to load the translated files to use them. For plugins we use the load\plugin\textdomainhttps://developer.wordpress.org/reference/functions/loadplugintextdomain/ function; it takes 4 parameters: 1. The name of text domain 2. This parameter is deprecated so always use FALSE 3. The path to the directory where your plugin's translations are stored Then add an action for the pluginsloaded hook and call the function we just created. php { return { 'Hello World', 'myguten' } ; }, save: => { return { 'Hello World', 'myguten' } ; }, } ; This...
According to GALA Globalization and Localization Alliancehttps://www.gala-global.org/language-industry/intro-language-industry/what-internationalization: > Internationalization is a design process that ensures a product usually a software application can be adapted to various languages and regions without requiring engineering changes to the source code. Think of internationalization as readiness for localization... Some practical examples of how internationalization is critical to multilingual products include: > > - Independence from a specific language/character set encoding > - Independence from specific cultural conventions > - Removal of hard-coded text > - Minimization of concatenated text strings > - Careful use of in-line variables > - Compatibility with third-party tools >...
WordPress security is as good as you make it and you can always make it better. This post will discuss tools and techniques for making your WordPress installation more secure. Some of these are default choices in WordPress but some are not only not the defaults but you have to manually add to configuration files or .htaccess files. Some of these rules will make local development harder as we expect constant change. However, these are excellent for production sites where we don't expect major changes and we expect them to be slower in adopting new code. This post links to...