May 6, 2020Testing a date input field with Laravel DuskHere’s a quick tip for those out there who tries to test an <input type="date"> field with Laravel Dusk. ->type('#birthday', '1990-01-01') doesn’t work the way you expect, but this does: ->keys('#birthday', '1990', '{tab}', '01', '01')Laravel1 min readLaravel1 min read
Nov 1, 2019Laravel Dusk error: “ChromeDriver only supports Chrome version 76”Suddenly one day, I got the following error message when running php artisan dusk : This version of ChromeDriver only supports Chrome version 76 Since it came out of nowhere, I figured a simple update might help… $ composer update …but it didn’t. At least the error message changed: Facebook\WebDriver\Exception\SessionNotCreatedException: session not created: Chrome version must be between 70 and 73Laravel1 min readLaravel1 min read
Aug 15, 2019How to increase the PHP 7.2 memory_limit on Mac OSI just ran a simple composer require [...] command in a Laravel project on my local machine. And so it begins! PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted [...] Really? Locally, on my computer? Anyway, Composer has a helpful section covering this topic on the Troubleshooting page. Troubleshooting - Composer This is a list of common pitfalls on using Composer, and how to avoid them. Before asking anyone, run composer diagnose…getcomposer.orgPHP2 min readPHP2 min read
Aug 9, 2019Custom sizes attribute with gatsby-image (by a Gatsby newbie)I’ve been working on my first Gatsby project recently: a headless WordPress blog! I love all the smartness Gatsby gives you out of the box and how optimized for performance it is. For example, these are some of the things the gatsby-image component takes care of: Image optimization Lazy loading …Java Script1 min readJava Script1 min read
May 15, 2019Laravel Valet: “sorry, you are not allowed to preserve the environment”So I ran a simple composer global update command this afternoon — you won’t believe what happened then! 😱 I tried to start Laravel Valet as usual: $ valet start …but suddenly got this error message, which I haven’t seen before: sudo: sorry, you are not allowed to preserve the environment The solution turned out to be this: $ sudo valet trust After that, valet start ran as expected 👌🏻 Hope this was helpful 🤗Laravel1 min readLaravel1 min read
Mar 19, 2019WordPress: How to get only direct child categoriesImagine having these categories in WordPress: - Movies - Sci-fi - Thriller - Action - Adventure - Comedy - Documentary Then imagine a category page called Movies on which we wanna list the child categories, but only the first level. So in this example, we just wanna see: Sci-fi Comedy …Word Press1 min readWord Press1 min read
Mar 11, 2019WordPress: oEmbed works with YouTube, but not VimeoI recently found myself having a really strange and hard to solve problem. When moving a new WordPress site from the development server to production, Vimeo embeds suddenly didn’t work anymore. After lots of googling, I found the following script: [PHP] Vimeo testing - Pastebin.com Edit descriptionpastebin.com If no headers is being printed, the server is blocking the Vimeo IP. So there’s nothing you can do about it yourself. Instead, you have to contact your web host and ask them to help you.Word Press1 min readWord Press1 min read
Feb 6, 2019Vue.js: load data with AJAX before component is renderedImagine a Vue Component which displays a list of posts based on a category. These are fetched from something like the WordPress Rest API. The template could look something like this: <posts-list category="<?php echo $category->term_id;?>"></posts-list> But how could we populate the data object with posts loaded asynchronously before the component is being rendered? It’s quite simple actually, using the created() lifecycle hook:Java Script1 min readJava Script1 min read
Feb 5, 2019WordPress: Wrap image caption with <figcaption>In order to change the default markup which WordPress creates when inserting an image with a caption, the img_caption_shortcode filter can be used. For example, if you wanna wrap the image and caption with a <figure> and <figcaption> instead of the default <div> , this is how you can do it:Word Press1 min readWord Press1 min read
Jan 28, 2019WordPress Rest API: Get custom taxonomy terms by parentWhat I wanted to do was something like this: <?php $terms = get_terms( 'my_custom_taxonomy', ['child_of' => 5] ); …but using the rest API provided by WordPress. This is how you make this query: /wp-json/wp/v2/my_custom_taxonomy?parent=5 Easy when you know it, a bit tricky when you doesn’t! 🤷🏼♂️Word Press1 min readWord Press1 min read