Per Søderlind

I code for fun

An SVG logo Custom Control for the WordPress Customizer

Another proof of concept. The custom control You create a custom control by extending the WP_Customize_Control class. I check for WP_Customizer_Control existence before adding custom control because WP_Customize_Control is loaded on customizer page only. list_svg() Create a option list with URLs to SVG files. The SVG files are defined in svg.json...

WP Gears and the Heartbeat API

Testing WP Gears and the Heartbeat API, WP Gears is at https://github.com/10up/WP-Gears. NOTE: this plugin is run continuously, triggered by 'plugins_loaded', you should use an event triggered by the user (onclick, onhover etc))

WordPress linting using Code Climate, the Swiss Army knife of code linting

  tl;dr -  Code Climate is a very easy to implement linter for PHP, JavaScript, CSS etc. [A linter] find code that doesn't correspond to certain style guidelines source: Wikipedia When I upgraded my plugins to support WordPress 4.6, I decided that I wanted to follow the WordPress Coding Standards....

101: How to fetch a git pull request

  You should test pull requests locally before you merge them with your code. Fetching a pull request from a remote repository is simple, just do: In your local project folder, do: git ls-remote You'll get a list like this: From https://github.com/soderlind/myproject.git 15438eca8b7f62f371985823fe6fa8c60d7a3b50 HEAD 15438eca8b7f62f371985823fe6fa8c60d7a3b50 refs/heads/master 4abd4e393cc1bc57af576a67a1a56b3dae6ecabd refs/pull/2/head e05af83eeebb01e52d8b42f24c570c8290e0b351 refs/pull/4/head...

On your Mac, use Larvel Valet for local WordPress and PHP development

[caption id="attachment_4777" align="aligncenter" width="625"] Photo by Richard Walker[/caption] You need Homebrew `brew install php70` `brew install mariadb` (server=127.0.0.1, username=root and password=an empty string) `brew install composer` `brew install wp-cli` `composer global require laravel/valet` Add ~/.composer/vendor/bin to PATH `valet install` `mkdir ~/Sites` `cd ~/Sites` `valet park` `mkdir ~/Sites/wp-valet` `cd ~/Sites/wp-valet` `wp...

DropzoneJS & WordPress REST API with Custom Endpoint

The plugin provides drag’n’drop file uploads and uses the wp rest api to upload the file. This version adds a custom endpoint, has code for handling the upload and uploads the file to uploads/yyyy/mm without adding the file to the media library.  If you need to upload the file to the...

DropzoneJS & WordPress REST API

The plugin provides drag’n’drop file uploads and uses the wp rest api to upload the file. BTW, I've written a similar plugin that uses the WordPress AJAX API for file uploads. dropzonejs-wp-rest-api.php dropzonejs-wp-rest-api.js Installation Save dropzonejs-wp-rest-api.php in wp-content/plugins/dropzonejs-wp-rest-api/ Save dropzonejs-wp-rest-api.js in wp-content/plugins/dropzonejs-wp-rest-api/js/ Use After activating the plugin, add the [dropzonerest]...