If you want to host and run a WordPress Playgroundyou can install it via Node.js. First install node.js – if you don’t have it yet, follow the guide on the node.js webpage.
Node.js works on Linux, Mac and Windows.
Then install the package wp-now by npm, like this_
sudo npm install -g @wp-now/wp-now
cd my-plugin-or-theme-directory
npx @wp-now/wp-now start
First line: on Linux and Mac use sudo, but probably not on windows.
Second line: you change to the directory with the theme or plugin to be tested.
Third line: now this will install WordPress in a hidden directort, and open a browser after a few seconds.
Then you’re ready to develop or test.
Reset
When you restart the site will appear as when you left it. However, sometimes you may need a new version. You can reset your site like this, and then you’ll get a new WP for your experiments:
npx @wp-now/wp-now start --reset
Start in a Theme Directory
A fast way to test a theme is to start wp-now up in the theme directory or in a plugin directory. Wp-now will then open WordPress in that theme. This is supereasy:
cd /localhost/wordpress/wp-content/themes/your-theme/
npx @wp-now/wp-now start
Blueprint
A blueprint is a JSON file, that will define settings like the version of PHP or WordPress. You can install plugins and themes via blueprints too. You can load the blueprint like this:
Options: –version Show version number [boolean] –path Path to the PHP or WordPress project. Defaults to the current working directory. [string] –php PHP version to use. [string] –wp WordPress version to use: e.g. ‘–wp=6.2’ [string] –port Server port [number] –blueprint Path to a blueprint file to be executed [string] –reset Create a new project environment, destroying the old project environment. [boolean] –skip-browser Do not launch the default browser [boolean] [default: false] –inspect Use Node debugging client. [number] –inspect-brk Use Node debugging client. Break immediately on script execution start. [number] –trace-exit Prints a stack trace whenever an environment is exited proactively, i.e. invoking process.exit(). [number] –trace-uncaught Print stack traces for uncaught exceptions; usually, the stack trace associated with the creation of an Error is printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be an Error instance). [number] –trace-warnings Print stack traces for process warnings (including deprecations). [number] -h, –help Show help [boolean]
WordPress Playground is made for experiments. However, plugins are not easy to install. If you want to install and use plugins you have to change the URL and add:
Sometimes you’ll see that your corrections to CSS or scripts don’t seem to work. If it is not an issue with your code, perhaps the problem is cashing either on the server or in the browser.
To me the best cure of caching issues is:
Use a plugin to clear the WordPress cache
The problem can be the browser cache, cure: Use a browser window that is not cached – e.g. a Fire Window in the DuckDuckGo browser, a private window in Chrome or Firefox.
Sometimes you have to use yet another private / fire window in order to see the changes!
In this tutorial you will learn how to modify a WordPress style and save it as your own. As a bonus you will be able to save your entire theme in a Github repository.
This tutorial is based on the most recent standard theme for WordPress (WP): Twenty Twenty Four. However, the principles should work for any block-based WP theme.
Select a relevant style
Modify the style
Now you can modify your style. In my case there was a lot of irrelevant information in the header and footer templates. I removed the unwanted informations on the frontpages template too.
You can edit the header and footer in Appearance / Edit / Patterns / Header
How to edit all headers in one go There is only one header here. This template pattern is used in many places. So if we edit this header, we will edit all headers in the active style.
In my case the colors were reversed in the header and footer, so that the background was dark and the text was made in a contrasting color. The links were changed too, since they would disaapear with this new background.
Here you see the header with reversed colors from the theme.
In this case a worked on a local computer, but you could work in a staging environment too. Now when the work with the styling is finished it is possible to export the entire theme and upload it to your webserver.
Export the theme
Under Appearance / Edit / Styles you can click the pen.
Then click the three dots icon found in the top right corner.
The menu to the right should appear.
Now you can export the theme. Click on Export. The file will be downloaded to your Downloads directory on the computer.
Fonts
I have tried to add fonts, but this experiment is only a partial success! You can see the fonts in the editor, and sometimes use the additional fonts with the blocks.
Permanent Marker works fine when my petj_rust style is enabled [this sample will only work as long as I use the petj_RUST style] 😉
However, if I try to add the costum font to a heading, the style is overruled!
Even a custom CSS !important clause is ignored by the theme. Perhaps this is a bug in Twenty Twenty Four?
If you open the zip file you’ll see the standard Twenty Twendty Four files. In the styles folder you can see a series of JSON files, one for each of the styles. If you want to have your own styles you can copy the rust.json file and give it a new name, e.g.
aGoodName.json
You can modify the JSON inside the file. A good start is to rename the theme name and add a description in the key value pairs, e.g. like this in your favorite editor:
"$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "title": "PETJ Rust", "description": "Multimusen's take on the RUST style.",
Save the JSON file, and yo are ready to go.
Tweaking All Styles
You can tweak all the styles in the JSON:
Colors
Fonts
Duotones
Blocks
But this has been covered in some of my other tutorials. You can even select to block other users from changing the palettes and similar settings.
Now you can upload the revided theme to WP. Here I’d prefer to upload to the web host via Filezilla. If Twenty Twenty Four is installed, just upload and overwrite the files.
Filezilla in the local directory with Twenty Twnety Four. And pointing to a similar folder in the directory:
wp_content/themes/twentytwentyfour/
The result
Now that’s all it takes to tweak a style. After the upload the theme will look exactly like what you did with the tweaks. Even headers and footers will look like your local version of the WP JSON Style.
Here is the final result, a new styled theme for Multimusen.dk:
Here is a short introduction to the Woocommerce REST API. In the tutorial you will learn how to present a product list from the REST API on any HTML page. If you want to create your own markup that does not depend on the limited Woocommerce blocks in the editor the REST API will open endless possibilities.
Sample Code on Github
The code from the tutorial is available on Github:
The Full Site Editor is not in Beta any more. There are attempts at improvements. But will the new user understand the complex features?
This morning I saw that the FSE editor is out of the somewhat chaotic beta state. That’s great news.
The first impression is positive because the interface is more logical now. You don’t have to search for the styles in weird places any more. All design options are presented in the FSE editor environment.
At last we have an easy to find navigation menu.
The styles have a menu handle.
The template and template parts are also available.
Navigation
The navigation was very hard to find in the Beta state. However, it’s still somewhat unclear what to do when you click the different menus.
They’ll send you to the page/post or template/template part, where the menu appears. There you’ll have to edit things.
Promising, but still a bit puzzling.
Styles
The styles will give access to the different style variations. That’s cool. Now they are more easy to find.
When you click edit you’ll get the actual styles of your site. That’s ok.
Templates and Template Parts
The template and template parts are listed as in the Beta version. At the + you can add another template.
For person beginning to use WP the template-concept is utterly confusing. At least I often meet users that don’t know the difference between content and a template.
FSE (full site editing) is of course cool, but we still need a very good introduction to questions like:
What is the difference between a template and a page?
What is the connection between a page and a template?
What is the best time to edit a template or should I add my content in a page or post?
Why do we need so many templates, and what are their functions in e.g. TT3?
Of course such questions show, that the person beginning to use WP does not know the basic concepts, like:
What is a Page (static content)?
What is a Post (blog, news rooll)?
What is a template (Design the looks of pages and posts, categories etc.)?
Will this Confusion End?
For the experienced WP user questions like the ones above are trivial. However, the strength of WP was alway it’s unserfriendly approach.
The learning curve in CMS systems like Joomla, Drupal or Typ03 is very steep. When I made Joomla solutions, often the users had to have tutorials.
Personally I fear, that WordPress has become extremely complex. But the new additions to the FSE editor is indeed a positive development.
When I began to use WP the strength was it’s ease of use. You installed WP. Began to write blog posts or create pages. End of story.
The modern user of WP will have to come to terms with very abstract concepts. The relation between content and template can be very hard to explain to new WP users.
For WP teachers and consultants the future is bright. New users will need an introduction course.
JavaScript libraries can add cool animations or parallax effects to a traditional webpage in HTML, CSS and JavaScript. Here you can learn how to do the same thing in the WordPress editor.
Case: Animate on Scroll (AOS)
Animate on Scroll is a populer animation library. In order to use the library on a single WP page or post you’ll have to load the CSS and JavaScript. Do this in a custom HTML block looking somewhat like this in the <head> section – or at least before the blocks you want to animate:
A web app is an application made by web technologies. The web app will run similar to a native app, that is if the user agrees to install the web app on the device. Several WordPress plugins are able to do this.
Creating a web app i WordPress is surprisingly easy. But make sure, that your web solution looks cool on mobile devices during your design. Probably one or more elements will need some CSS tweaks.
Here I don’t recommend page builders such as Elementor, Divi &c.
Plugin: PWA for WP & AMP
Install this PWA plugin:
It’s easy to use and works in most mobile browsers:
Chrome: works like a charm. You’ll get a “want to install” message. That’s it.
AdBlock: you have to install the app manually. However, that’s what we’d expect from this browser, isn’t it?
Push Notifications
Here you have to add a plugin to the plugin. After that create a user profile. Add the token to the PWA plugin. Now pushing should be possible. That is in theory.
When I run the browser version, I’m asked whether notifications are ok. Just answer yeah here. Below: the plugin for push notifications.
Pro & Con
Pro: a web app will run without web connection if the pages are cached. The pages visited will be cached too. And the app is fast.
Con: why install yet another app when you can just browse the web?
Con: When the app is active the cashe now and then work in unexpected ways. You may see old versions of new pages. Because of this I removed the app.
These days I’m following tutorials about block theme development. In these articles I’ll collect the best of them.
In the excellent WordPress.tv series Nick Diego has this workshop about theme.json. Topics covered are:
How to add fonts
Color palette – and how to use the variables
Style variations
How to use the Child Theme plugin
If theme.json seems baflfing to you Nick’s video is a very good walthrough.
One of the participants asked about child themes. Nick answered that the child theme is still possible. It’s useful for theme variations. The only file you need to edit in the child theme could be theme.json.
The idea seems good, since you would get the benefit from theme updates. If you create a simple copy of a theme, you will not get such updates.
Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.