[Howto] Add post-thumbnails to wordpress child themes.

I needed a way of adding post-thumbnails ( featured image in 3.0 ) to my latest theme.

The theme JustCSS is a child theme of Toolbox.

I wanted a way of adding this code to functions.php without editing the Toolbox core files, so updates are still workable.

First thing was to enable featured images by adding the support line to functions.php in my child theme folder.

Now I can go ahead an assign an image to my test post but the image will never show so I needed to add a filter to the_content to add the thumbnail.

Here is the finished code in my functions.php:

[php]
add_theme_support( ‘post-thumbnails’ );
add_filter( ‘the_content’, ‘add_thumbs’ );
function add_thumbs( $content ) {
the_post_thumbnail( ‘thumbnail’ );
return $content;
}
[/php]

The theme will be available on this site soon, and on WordPress.org as soon as child themes are allowed.

[Howto] Add post-thumbnails to wordpress child themes.

WordPress-Super-Cache and Text-Link-Ads Fixed!

For ages Ive been trying to figure a way to get super-cache to work with Text-Link-Ads, and now I have the solution!

The cache would only work in ‘half-on’ mode, if ‘full’ caching was enabled folders would be created in the cache folder but no files were written. This is because TLA was altering every post and page looking to see if it had to insert an advert.

After a lot of searching around I found out you can tell the cache which files to ignore totally by setting DONOTCACHEPAGE to true, so I looked through the TLA plugin code and eventually found the a place for it, so DONOTCACHEPAGE gets defined only on a post/page that actually has an ad to insert.

On to the fix…

open up the TLA plugin file and look for this line around 589:

[php]if (isset($this->ads[$postId]) && is_array($this->ads[$postId])) {[/php]

Add blelow this line:

[php]define(‘DONOTCACHEPAGE’, true);[/php]

so the codeblock will look like this:

[php]function insertInLinkAd($postId, $content)
{
if (isset($this->ads[$postId]) && is_array($this->ads[$postId])) {
define(‘DONOTCACHEPAGE’, true);
foreach($this->ads[$postId] as $ad) {
$second = false;
$specialChars = array(‘/’, ‘*’, ‘+’, ‘?’, ‘^’, ‘$’, ‘[‘, ‘]’, ‘(‘, ‘)’);
$specialCharsEsc = array(‘/’, ‘*’, ‘+’, ‘?’, ‘^’, ‘$’, ‘[‘, ‘]’, ‘(‘, ‘)’);[/php]

You can now activate full mode in super cache and turn on gzip!

WordPress-Super-Cache and Text-Link-Ads Fixed!

VLC 1.1.0 HD ready!

What’s new?
Ready for HD

* GPU decoding on Windows Vista and 7, using DxVA2 for H.264, VC-1 and MPEG-2
* GPU decoding on GNU/Linux, using VAAPI for H.264, VC-1 and MPEG-2
* DSP decoding using OpenMax IL, for compatible embedded devices
* Improved support for MKV HD, including seeking fixes, and 7.1 channels codecs
* Support for new codecs, like Blu-Ray subtitles, MPEG-4 lossless and VP8

NB: so far, on Windows for GPU decoding, VideoLAN is recommending nVidia® GPU, until ATI® drivers are working with VLC architecture, and until the VLC developers get access to some Intel® hardware supporting GPU decoding.

Extensions
New add-ons and script framework so one can personalize its vlc.

* Written in lua
* 2 main types of scripts:
o content add-ons, integrated in the playlist
o functionnalities extensions, like metadata searching on the web, or subtitles look-ups
* Very Simple

Web improvements

* Support for WebM decoding and encoding
* Improved web plugins
* Better streaming capabilities

Better Audio experience

* Integrated playlist in the Qt4 interface
* Multiple views (like album art) in the playlist in the Qt4 interface
* Support for AMR-NB, Mpeg-4 ALS, Vorbis 6.1/7.1, FLAC 6.1/7.1 and WMAS
* CDDB and CD-Text works now on the Windows port when listening to CD-Audio
* Support for DVD-Audio files (.aob)
* Improved meta-data and album-art support

Faster, Lighter

* Faster decoding, with up to 40% speed-ups, in HD resolutions
* First part of the Video Output core rewrite
* Removal or rewrite of dozens of modules, code simplification and tens of thousands of lines of code removed
* Some functionalities that are less used are now moved to extensions
* More assembly optimizatinons, especially SSSE3/SSE4 and ARM Neon
* Fewer threads used

Better for developers

* Simplified and improved libVLC, removal of exceptions for better C integration
* New phonon-backend for Qt applications, on all platforms
* New C++ bindings

VLC 1.1.0 HD ready!

Combat domain spoofing with SPF records

Recently my domain was used to send spam. I found this out when my VPS host sent me an alarming email informing me he was getting complaints that emails were being sent from my domain!

This is possible because anybody can put whatever the like in the From field so they were putting [email protected].

I had setup my domain as a ‘catchall’ address which was BAD, I didn’t realize this was a spammers dream!

So how to fix this:

First make sure you DONT use catchall addresses.

Now the SPF record comes in to play.

I had to add the following to my DNS record for pross.org.uk:

v=spf1 ip4:193.104.186.137 include:_spf.google.com -all

This allows my server IP and spf.google.com to send from pross.org.uk all else is -all a hard fail.

This seems to be working perfectly well so far, spam in my inbox has dropped dramatically and my VPS and DNS hosts are a lot happier!

I’d like to thank Rens Ariens at Yisp.nl and Joshua Anderson at http://freedns.afraid.org

Combat domain spoofing with SPF records