14
Jun 18

Quick tip – Optimize PNG and JPG via a linux shell

For WordPress there are quite a few decent plugins to optimize images everytime you upload one ( I like EWWW ). But what about your old ones, and the ones that come via your theme and somebody forgot to do this?

Fortunately it’s quite easy to optimize images. These commands you can use to recursively batch process a whole directory structure. Just wait, and done.


find ./ -name '*.png' -print0 | xargs -0 optipng -clobber -preserve -nc -nb -o7

Optipng is for PNG images. Make sure it’s installed on your computer. The extra options are for preserving the permissions, overwriting and using quite some processing to come to the best optimization. You can alter the options.

If you want to use a different directory change the ./ (current) to something else.

For JPG’s :

find ./ -name '*.jpg' -print0 | xargs -0 jpegoptim -p -t -o


07
Feb 18

Quick tip – Checking how much time your javascript runtime needs

I don’t often run into things where it surprises me how easy a solution is. Much less so with Javascript. This quick tip may be for you.

Recently I had some performance issues with runtime javascript taking a long time. You can use the following commands to check how long it takes for something to run :

console.time('someFunction');

someFunction(); // or some code

console.timeEnd('someFunction');

The console neatly spits out the amount of miliseconds it took. Nice.


15
Apr 15

Updating term counts in WordPress / Woocommerce

Last week I had a short hickup of Woocommerce regarding the numbers count of a few custom taxonomies. Then I noticed there is actually no function in WordPress to easily recount terms in WordPress. In Woocommerce settings there is a ‘recount terms’ function, but it looks like it doens’t recount any custom taxonomies you have working with Woo, only it’s own terms. Other than that, there is no button of the sorts to recounts terms anywhere.

Continue reading →


10
Sep 14

It’s time to get serious about WordPress security

Be honest: How secure are your WordPress installations? Securing WordPress has in the past years always been an after-thought or for the very big and professional blogs. Probably 90% has no other protection then the basic anti-spam protections like Akismet, which is really really needed.

exploit-code

With WordPress being on the rise as one of the most important CMS-systems so come the security flaws and problems. I’m not saying WordPress is unsafe since the core seems to be quite holding up to all the pressure. The Achilles’ heel seems to be the plugins. Which is also one of the most important features. Let me set out a few basic protection strategies to prevent bad people from breaking in.

Continue reading →


13
Apr 14

On WordPress themes – A guide

wm_themesthemesthemes
Themes, themes, themes

There is a lot to say about WordPress themes. For beginners it seems quite simple. Take one, install and be happy forever. More experienced users know that finding the right theme in the jungle of the internet is quite an undertaking. Especially if you or your client has specific wishes. The quality between themes also tends to vary a lot and not in the long term your ‘perfect’ theme might become a burden. In this article a few general guidelines what you should check before going with a theme.

Continue reading →


13
Feb 14

Making a custom column in WordPress admin sort by reverse order

It’s known and well-published that you can add custom columns to your WordPress  admin post overview screen. For instance see this article on the codex.Then you can make this custom column(s) sortable,  as described here.

For a recent project I had to make something like that, but including a checkbox with it. By default WordPress will start to sort your columns ascending, from low to high. This checkbox basically has two values, 0 or 1 ( boolean-like ) so starting ascending the posts who were not marked came first, so you had to click twice if you wanted to see tagged posts ( and why sort on a column like that otherwise ).

The solution is a small snippet that’s not really documented:

function checkbox_post_sortable($columns)
{

// second param is sort desc by default
$columns[“checkbox_post”] = array(‘featured’,1);

return $columns;
}

Usually in tutorials the column is defined by $columns[name] => title. By simple making it an array with the second position 1 WordPress will not sort your column descending when you click it first.

 


15
Oct 13

Background color on inline element with padding

A tip I would like to throw out since many people seem to be searching for this. It’s a difficult problem, but here is a (rather dirty) way to use a background color on inline element (like span) and have padding as well. This is a solution when you want text with a background color plus padding – without filling the whole element block .

The problem

An inline element doesn’t begin new lines usually. If you ever tried you would see that padding will only apply to the begin and end of this element. If there are line-breaks it doesn’t look pretty.  This means limited styling options.

A block element does support padding but you can’t put the background on the text only.

Solution mostly

Most problems can be overcome by defining the inline element as a block level element ( or better just use a block element like <div> .

If you can control the output this way, you can put every line output on a different container. This often doesn’t fly with CMS-systems where the system outputs the whole ( as content ).

Better yet, punch the designer who thought of this.

..But

In this specific case you want the best of both worlds and that often doesn’t fly with web design.

Fortunately there is a  Jquery plugin by Jeremy Harris which does this after your page loaded. This is important since often it’s not sure how many lines exactly your output will take (especially when the content is dynamic). The plugin splits the lines into seperate containers which you can use to style your padded background on.

This also works if you need to animate or do other tricky stuff with multi-line content.

 

 

 


28
Sep 13

Simple Category Icons version 1.1

Today I released version 1.1 of my ‘Simple Category Icons’ plugin. I added some cool new features like:

  • Icons for any taxonomy in WordPress
  • Option to get icons directly for a term id
  • Add a custom class to the icon image
  • WordPress filters to customize output

If you need to categorize your theme icons by any term (category, tag, whatever ) in any image size; pick up Simple Category Icons today. Give a shout if you do, I always like to hear something.


17
Sep 13

Find your wiki : Wikimatrix.org

Another short tip on a site that is remarkably hard to find but very handy: Wikimatrix. I often use wiki’s to store information and short notes to be able to find things back quickly. As always the problem is what wiki software to run. There are literally thousands of options.

On Wikimatrix.org they offer a wizard which will help to narrow down to choices. Besides you can side-by-side compare different wiki’s. Not all wiki’s are that good though ( keep in mind ) but this site will help to narrow down your search.


27
Aug 13

Skype : No notification sounds on Linux / Ubuntu

Today I want to share a short hint on using Skype under Linux which cost me some time to discover. I was having audio when calling but the notifications somehow didn’t work. Which is annoying when being ‘Away from Keyboard’ but expecting some calls.

Continue reading →