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.

  • WP Engine Builders viser hvordan du bygger “ptterns” eller pÃ¥ dansk “blokgrupper”

    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.

  • 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.

    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.

  • SÃ¥dan kan du tilføje meta-tags til SEO med “Simple Custom CSS and JavaScript” plugin’et.
    • Ã…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:

    Open Graph Tags
    Open Graph tags – formatterer hvordan links tager sig ud pÃ¥ SoMe. Derfor er dette billede kun en antydning af, hvordan det kan tage sig ud i de sociale medier. I sidste ende bestemmer SoMe udseendet.

    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

  • DALL·E-2024-09-10-08.25.53-A-dynamic-manga-style-illustration-featuring-a-witch-with-flowing-robes-and-a-pointed-hat-standing-on-an-anchor.-A-page-from-a-magical-book-is-seen-l
  • 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

  • wp-now streamlines the process of setting up a local WordPress environment.”

    https://www.npmjs.com/package/@wp-now/wp-now

    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
    wp-now started my homemade theme from the theme directory. In this way wp-now is a great tool when you need to test either a theme or a plugin.

    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.

    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

    Woo Blocks – in ten minutes

    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

    Top ten Woo Blocks by Jamie Marsland

    Tutorial

    The following tutorial is made in a Kadence Theme. That’s why the Dashboard looks a bit different.

    Jack – Woo shop no plugins
Enable Notifications OK No thanks

We use cookies - more information

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.

Close