Denne tutorial viser, hvordan du kan oprette blokgrupper (dvs. “patterns”), som kan genbruges overalt pÃ¥ dit site. Blokgrupperne minder lidt om CCS-variabler, hvor du genbruger nogen settings og redigerer dem fra ét sted.
WordPress
These days WordPress power more than 40% of all web pages. Sooner or later you will have to use a WordPress solution – and want to tweak it. Here are my tips and tricks for advanced WordPress developers.
-
SÃ¥dan viser du et produkt med en shortcode.
[products limit=”9″ columns=”3″ orderby=”popularity” class=”quick-sale”]
Indsæt shortcoden ved hjælp af den særlige shortcode blok, hvor du fx kan skrive:
[products limit="9" columns="3" orderby="popularity" class="quick-sale"]
Læg mærke til, at du med parametrene kan definere, hvordan produktet skal vises på din side:
- Limit: hvor mange produkter vil du vise?
- Columns: hvor mange kolonner skal vises?
- Orderby: sorterer ved hjælp af parametre, som popularity, asc, desc etc.
- Class: har i dette tilfælde ikke noget at gøre med CSS; men derimod en grupering (her: Quicksale)
Woo skriver i dokumentationen, at du kan filtrere:
“TheÂ
[products]
 shortcode allows you to display products by post ID, SKU, categories, attributes, with support for pagination, random sorting, and product tags, replacing the need for multiples shortcodes such as Â[featured_products]
,Â[sale_products]
,Â[best_selling_products]
,Â[recent_products]
,Â[product_attribute]
, andÂ[top_rated_products]
, which were needed previously.“Læs mere om Woo shortcodes her:
-
Et andet sted har jeg vist, hvordan du kan ændre billedernes proportioner sÃ¥ de ikke behøver at være kvadratiske; men hvorfor anbefaler Woo at du i begyndelsen anvender billeder det kvadratiske format 800×800?
Det er simpelt hen fordi, at Woo har lavet grids mv. efter at billederne er kvadrater. Men det behøver du ikke at rette dig efter.
Hvorfor 800x800px
Verden ville være mere kedelig, hvis alle billeder var kvadratiske. SÃ¥ hvorfor anbefaler Woo, at billeder pÃ¥ shoppen formatet 800 x 800 px?Woo har et grid, der antager, at billederne er kvadratiske. SÃ¥ nÃ¥r du bruger grid-baserede visninger (“views”) sÃ¥ skal visningen ændres til fx fuld størrelse.
Quadratisch. Praktisch. Gut.
(Fra chokoladereklame)Man kommer umiddelbart til at tænke på ældgamle reklamer for Ritter Sport chokolade. Men, hvad nu hvis du ønsker et design, hvor billederne enten har portræt- eller landskabs-format?
Alternative formater
Du kan sådan set godt lægge produktbilleder ind, der har andre formater.Woo cropper tilfældigt
Det er endnu ikke muligt at styre, hvor billedets skal være i beskæringen. Så de beskæres noget tilfældigt. Billedet bliver ikke forvrænget; men det betyder, at du ikke kan styre produktvisningen 100%.Rediger den rigtige skabelon
I Twenty twenty-four – og sikkert ogsÃ¥ de foregÃ¥ende blokbaserede temaer – kan du redigere WooCommerce skabeloner, der styrer, hvordan dine varer vises.I disse skabeloner kan du sætte billedernes proportioner til fx fuld størrelse.
-
Du kan tilføje SEO som tilpasset HTML. Fordelen ved denne metode er, at du ikke er afhængig af plugins med gumpetung kode. Håndkodet SEO er både en enkel og meget effektiv metode.
- Ã…bn “Simple Custom …”
- Lav en ny HTML
- Marker at koden skal sættes ind i “Header” (hvilket er lidt ulogisk, eftersom koden bliver sat ind i <head>)
- Opdater
- Tjek om dine SEO-tags kommer ind i koden.
Her er en SEO-tag generator:
Denne manuelle metode er ikke nær så grundig som det du ville få ud af at bruge plugins, som Yoast og lignende. Men det er godt nok til at passere en Lighthouse test.
Hvis du har mulighed for det, så kunne Open Graph Tools tilføje noget ekstra i forhold til SEO og SoMe.
Open Graph
Med Open Graph kan du generere links, der ser omtrent sådan ud, når du indsætter linket i en SoMe eller lignende:
Du kan skabe de nødvendige OG-tags med knappen herunder:
Kode fra min header:
<!-- PETJ manuel SEO --> <!-- SEO stuff --> <meta name="title" content="Woo Garagesalg"> <meta name="description" content="Testshop for multimediedesignere. Viser hvordan du kan sætte en eShop op med Woo. "> <meta name="keywords" content="Multimediedesigner, e-commerce, woo, woocommerce, eShop, "> <meta name="robots" content="index, follow"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="revisit-after" content="7 days"> <meta name="author" content="Per Thykjær Jensen, MA IT, interactionDesign and Multimedia"> <!-- Open Graph Stuff --> <meta property="og:title" content="Woo Testshop"> <meta property="og:description" content="Testshop for Multimedia Designers. A class about Woo."> <meta property="og:image" content="https://woo.thoth.dk/wp-content/uploads/2024/09/8c2df8a4-0f76-4a92-94f8-5f26d7591227-e1727429387594.jpeg"> <meta property="og:url" content="https://woo.thoth.dk"> <meta property="og:type" content="website"> <!-- /PETJ -->
-
By pure HTML, CSS and JavaScript
-
Grid Blokken
Grid blokken giver nye muligheder for layout med et CSS-agtigt grid.
Medie og tekst blok
-
If you can’t push to git you can try to increase the git buffer like this in your terminal, and press enter: If this does not work, test whether git is installed on your system. Try this in the terminal, and press enter: If you get an answer like this: If you get an error,… Read more: Solution: Git disallow error
-
Denne tutorial viser, hvordan du kan oprette blokgrupper (dvs. “patterns”), som kan genbruges overalt pÃ¥ dit site. Blokgrupperne minder lidt om CCS-variabler, hvor du genbruger nogen settings og redigerer dem fra ét sted.
-
Den nye version af WP kommer selvfølgelig med en ny version af standardtemaet, som præsenterer de nyeste muligheder med WP. Uanset om du bruger standardtemaet eller noget andet, så er det altid en god ide at sætte sig ind i nyhederne.
-
-
Try.new is an alternative to WP Playground. It will create a WP instance that will last for half an hour or so. Enough to try out new features.
When you test, try the WP Beta Test plugin.
Review: Try something else
To be honest try.new is just an attempt to monetize WP Playground. Why use it – when you can get the same options for free with no time limit?
Other Posts About WP
-
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:
npx @wp-now/wp-now start --blueprint=path/to/blueprint.json
The content of blueprint.json could be something along these lines:
{ "landingPage": "/wp-admin/", "preferredVersions": { "php": "7.4", "wp": "5.9" }, "phpExtensionBundles": [ "kitchen-sink" ], "steps": [ { "step": "login", "username": "admin", "password": "password" }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "instant-images" }, "options": { "activate": true } }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "w3-total-cache" }, "options": { "activate": true } }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "wordpress-seo" }, "options": { "activate": false } }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "ewww-image-optimizer" }, "options": { "activate": true } }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "blocks-animation" }, "options": { "activate": true } }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org\/plugins", "slug": "font-awesome" }, "options": { "activate": true } } ] }
“Man” wp-now start — help
Here are the options from the man page:
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]For more information, see:
-
Gallery of Blueprints
Blueprints for a range of projects, watch the gallery on Github:
Developer Resources
Networking and Storage
-
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:
&networking=yes.
If you have local storage you will be asked if you want to continue working with the local files. Just answer yes.
https://playground.wordpress.net/?storage=device&networking=yes
Playground is experimental. Some plugins will not run here. So you have to experiment. For example Kadence Blocks work like a charm. Jetpack did not.
-
These are my research notes about the new Woo blocks.
By now WooCommerce has changed totally. Now everything is block based, and this will make all editing much more easy – since all is done by drag and drop. Exactly as we know it from the Gutenberg editor.
Jamie Marshland: 10 minutes Woo Introduction
In Jamie’s video you’ll hear that it’s possible to work with categories, keywords and tags in the page templates. Here are a few tips on how to do this.
Woo Blocks
Click the button and read more about the new blocks aka “Set up products”:
Categories, Keywords, Tags
You can filter by taxonomies. Obbiously we’ll need blocks from a premade template as our model. Here you can eiter use or copy the blocks from one of the filtering templates:
Click the button and follow the instructions by Woo.
Woo: Top Ten Blocks
Tutorial
The following tutorial is made in a Kadence Theme. That’s why the Dashboard looks a bit different.