BDWM is a very small company, or “Bedrijfje” as we like to call it, that (or “Dat“) makes Websites. Makes translates to “Maakt“, in case you were wondering about that.
BDWM was founded in 2010 by Jules Colle: a nerd who’s specialized in WordPress development. He really sucks at design, but he knows one or two things about web development. So if you already have a design, then he might transform it to a website or web application for you, maybe.
This website is mostly a place for random thoughts. Here are some recent ones:
- Gutenberg: Case study: convert group of file blocks to ACF blockHow to convert a block into another block? Let’s convert this (source block) to this (target block): Before we can do that, we need to define the template for the target block. I’m going to use some … Read More
- Gutenberg – How to update blocks and block-templates in bulkAt the time of writing, there is still no documented way to update blocks. So here is how I would update all my blocks: Loop trough all posts. Find patterns matching:<!– your-block –>*<!– /your-block –> Optional: convert … Read More
- Create your own wp-env npm packagewp-env is a super nice tool to kickstart plugin and/or theme development. It is zero-config, which makes it very usefult for people who don’t like to mess around with Dockerfiles, manually downloading WP, basic configuration, setting up … Read More
- Contact Form 7 toggle buttonsYou don’t need any fancy plugins to turn your checkboxes or radiobuttons into actual buttons. Just good old CF7 with some basic CSS will do. Simply create your form like this: It’s very important to include: use_label_element … Read More
- Gutenberg: how to insert a reusable block in the editor with JavaScriptAccessing core blocks and custom made blocks, is pretty straight forward. For example, if you want to get the paragraph block, you could do so with: And if you want to insert a paragraph, you can easily … Read More
- Gutenberg: how to force sidebar to be always open on post edit screenAdd this to your functions.php … Read More
- Gutenberg: custom validation / how to prevent post from being savedThis script will disable the Publish/Update button: To make the post publishable again, you can do: Very nice. But how is this useful? Here are a couple of use cases. Force users to enter a post title. … Read More
- Gutenberg: Prevent specific block from being removableIdeally, we should use template_lock as much as we possibly can. But with the problems it introduces currently, and because there might be special use cases that template locking cannot handle, I wanted to explore a way … Read More
- Gutenberg: Problems with template_lockIn my previous post, I described a way for developers to create a custom user interface for a specific post type. This approach relies heavily on using template_lock=’all’ in combination with templateLock={false} on some of the child … Read More
- Gutenberg: creating an advanced custom admin user interface for your post types with the block editor using template lock.As a freelance developer, I want my clients to have an easy to use interface when creating posts. Before WP 5.0 (and before Gutenberg) I used Advanced Custom Fields a lot for this purpose. An example interface … Read More
- Gutenberg: set category with dispatchSet the category with id termId and post ID currentPostId: Both termID and currentPostId need to be integers. use parseInt to enforce this if necessary. Custom taxonomy Same thing, just use your custom taxonomy slug instead of … Read More
- WordPress core development with Xdebug and VS CodeI had a bit of a struggle to get Xdebug working with wordpress-develop, but the solution turned out to be very simple. So I’m sharing it here for future reference. … Read More
- Dynamically populate a Contact Form 7 dropdown list (or any other input field)With Contact Form 7 the normal way to create a drop down list, looks like this: That’s all very nice, but what if this information tends to change often? You probably have a data source already, be … Read More
- Gutenberg: custom validationThis is a work in progress. The plan is to list all possible validation patterns for custom blocks. At the point of writing it seems like Gutenberg does not provide an out-of-the-box validation mechanism. https://bdwm.be/gutenberg-how-to-make-post-categories-required/ … Read More
- Gutenberg: how to make post categories required?This is how: So, what’s happening here? First we get all the currently selected categories with: Then we subscribe to any changes in the data store. If we detect a change in the selected catergories, we check … Read More
- Use react in your wordpress pluginsTry this: https://github.com/pwkip/wp-simple-react-starter-plugin … Read More
- setting up PHPUnit for plugin development on Local by FlywheelGet local by flywheel Add a new local site Custom install PHP 7.3 nginx Mysql 5.6 WP user: admin WP password: admin Go to WP admin Install and activate the plugin you would like to test SSH … Read More
- Xdebug Remote debugging with PHPStorm and Digital Ocean DropletSet up a remote server with PHP and XDebug installed. Because firewalls will be firewalls, we probably will need an SSH tunnel set up to the server in order for XDebug to work. So, better say goodby … Read More
- How to hide menu items from wordpress admin for your clientsJust use the Adminimize plugin! If you don’t wanna, here are some functions function remove_menus(){ if (!current_user_can(‘administrator’)) { remove_menu_page( ‘index.php’ ); remove_menu_page( ‘upload.php’ ); remove_menu_page( ‘vc-welcome’ ); remove_menu_page( ‘tools.php’ ); remove_menu_page( ‘edit.php?post_type=vacancy’ ); remove_menu_page( ‘edit.php?post_type=branch’ ); remove_menu_page( … Read More
- How to create dynamically populated cascading dropdown-lists for Contact Form 7Something I had to deal with quite often lately, is creating dynamic drop-down lists in WordPress, like this: As always, I like to use the WordPress plugin Contact Form 7 as a basis for all my form-driven projects. … Read More