Per Søderlind

I code for fun

  1. wp-plugins

Category: wp-plugins (Page 1 of 7)

My WordPress plugins are ready for 4.6

Tested & found compatible with WordPress 4.6. My plugins are following the WordPress Coding Standards.

Plugin Travis CI Code Climate
CSS Flags library
Date and Time Picker field
Debug Bar List Script & Style Dependencies
delicious tagroll shortcode
Google Tag Manager Multisite Admin
lorem shortcode
Metro Share Social Fonts
My Permalink Demo
Read Offline
Remove the “Comments are closed”
WP Anchor Header
WP Link To Playlist Item


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.

Read More

DropzoneJS & WordPress AJAX API


dropzonejs-wordpressThe plugin below demos how to integrate DropzoneJS with WordPress. BTW, I’ve written a similar plugin that uses the WP REST API for file upload.

Read More

A faster load_textdomain() for WordPress

Somehow, living outsite the 7 bit world of the US, we’ve missed that loading translations in WordPress is extreamly slow. Using the pluging below, you can improve your pageload by 40ms per request.

Read More

Best practice enqueuing a dynamic CSS or JavaScript in WordPress


TL;DR I’m using WordPress Ajax and Nonces, a plugin that demonstrates how to enqueue dynamic CSS and JavaScript in WordPress is available at GitHub.

I’m boldly claiming that this is best practice for dynamically loading a style or script in WordPress. Why?  The loaded code is protected by a nonce. Disagree? Please tell me why, I’m learning every day.

The dynamic CSS

 `require_once dirname( __FILE__ ) . /dynamic-css.php;`

The dynamic CSS (and JavaScript) is simple to create, and since the script is included you have access to all the WordPress functions, actions and filters. Forinstance, you can get the value using get_option , add the value and write to standard out:

//prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
header( "Content-type: text/css; charset: UTF-8" );

//get value from options, settings etc
$color = 'blue';

a {
	color: <?php echo $color;?> !important;


Page 1 of 7

Powered by WordPress & Theme by Anders Norén