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
someFunction(); // or some code
The console neatly spits out the amount of miliseconds it took. Nice.
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 →
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.
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 →
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 →
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:
// second param is sort desc by default
$columns[“checkbox_post”] = array(‘featured’,1);
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.
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 .
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.
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.
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.
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.
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 →