Archive for August, 2012

Date: August 24th, 2012
Cate: ICT

Adding Feature Image to WordPress RSS

So, I wanted to pull in the feature image to a WordPress RSS feed. It took me a little while to figure it out but it was easy enough in the end. The finished product looks like this:

add_filter('the_category_rss', 'add_feature_image');

function add_feature_image( $content ) {
	global $post;
	if(has_post_thumbnail( $post->ID )){
		$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
		return $content . '<featureimage>' . $image[0] . '</featureimage>';	
	}
	else return $content;	
}

So, I first add a filter to the category rss output. Why category I hear you ask, because when you look at /wp-includes/feed-rss2.php you’ll see that the category output in the rss is the only one that outputs it’s own tags. For example, the link tag looks like this:

<link>< ?php the_permalink_rss() ?></link>

So it’s no good for adding tags to. the_category_rss() outputs returns the category names in a tag called category. With me?

Then the filter runs a function (add_feature_image()) which checks to see if there is a feature image and if it does, appends a featureImage tag with the image’s url to the end of the categories.

The above is simply packaged up into a plugin and enabled in the admin section.

Easy!

Date: August 23rd, 2012
Cate: Politics

Privacy

I’ve been trying to write a post on the importance of privacy because I feel like it’s been forgotten but I just can’t get it to come out right. The crux of the point I want to make is that privacy is a civil right and it’s an important one. It protects us, as individuals and members of a community for the excess of government and business and is one of the things that allows people to scrutinise government without fear of reprisals. If governments know everything they can make life very difficult for those that disagree with them… you know, like in Syria, China, Iran, and a whole bunch of countries it’s very easy for us in the west to wave our finger at.

But that’s the thing, we do a lot of finger wagging because, for the most part, we live in a democracy and can take a certain amount of free speech for granted. Moreover no one fortunate enough to live in most western democracies (or at least the anglosphere – one can always think of examples to counter these blanket statements about geographical regions can’t they) has a living memory of anything other than what can globally be considered a fairly high level of freedom.

So we don’t value it. We don’t think anything bad could happen here because for most of us it hasn’t ever happend. We’ve lived during peacetime and have never really had to watch what we say. We trust government too much – an institution that has (or should have) built in checks on it’s power because it is so easy and tempting to abuse.

So these days we just hand over all our personal information to reasonably unregulated corporations – at least as far as protection of private information is concerned – and assume that everything will be fine. I don’t have anything to hide, I haven’t broken any laws, what could possibly go wrong?

So I want to yell from the roof tops: “Don’t take this for granted. We need to protect our privacy so we remain free. Give them an inch and they’ll use it to take the next inch.”

But instead I feel like I’m being conspiratorial when I even try to say that legislation around cookies is important and all these ‘cyber security’ laws that have been implemented since 2001 are dangerously eroding rights that took centuries of fighting to gain. But instead I log back into my google account so that one of the richest companies in the world can keep an eye on my every move to sell me things that I don’t want, I was just looking them up for a client at work.

*sigh*