Archive for the ‘Updates’ Category

Welcome Back, Welcome Back…

Sunday, February 21st, 2010

The trip to Vancouver was a mixed bag, mostly a success, but hard work. Vancouver has not gotten any cheaper, in fact it’s generally more expensive, especially in terms of transportation… Skytrain is a whopping $2.75 per zone (of which there are four, more or less) and add five dollars if you need to get to Vancouver International Airport.

Is it useful? Absolutely, just about everything you might need to get to in Vancouver is accessible by Skytrain or Bus. Lets just say I probably spent in the area of ninety dollars in three weeks on transit alone, and that’s with a lot of casual forgetfulness thrown in to soften the expense.

Random Self Portrait, Vancouver Art Gallery. © 2010 Peter Demaria

The city looked pretty as ever.. Olympic-ness as far as the eye could see, and characteristically bustling with metropolitan activity, most of it reserved and polite. I was considering a relocation on this trip, and visited upwards of sixty different Design-related business over a two day period. Almost all of them were in stages of post-Olympic-business shock or at a near standstill and praying for signs of economic life. If someone is reaping the boon of Olympic spending, it’s not your average boutique design firm.

Granville Street, Vancouver BC. © 2010 Peter Demaria

One thing I loved about the Vancouver Olympics was the level of support for local artistry and culture. There were tonnes of art installations, and the Native component of BC’s cultural landscape was pretty well represented, even in the official merch’ offerings. There was plenty of discontent around, but many of the admittedly disgruntled were proud of how Canada was getting behind the Olympics.

For all its issues, if you can afford to live there, Vancouver is probably one of the prettiest, safest and friendliest cities in the world!

Tags: , , ,
Posted in Updates | No Comments »

Bienvenue au Canada!

Wednesday, January 13th, 2010

Tomorrow morning at the bone-chilling hour of 4:00am we depart for Canada, so stoked! Friends and family, good eating and drinking await…Feel free to contact me, I won’t be completely off the grid, though it’s entirely possible I will be on top of a mountain with some good friends, eying some fresh, fluffy snow…

On return, with most of my web projects squared away, I plan on digging into some quality painting and drawing. You can expect to see some fresh T’s for Sweet Nothing Clothes, and some finished paintings as well…

jim

Acrylic on panel, work in progress. Peter Demaria © 2010

À la prochaine!

Tags: ,
Posted in Updates | No Comments »

Straight up Functional?

Monday, October 19th, 2009

Had a minor conundrum the other day involving some pretty standard Wordpress type stuff.. as these things usually sometimes go, it was about 1:30 am before I actually had a working solution. Note, solutions below are not for beginners, you WILL break your theme if you don’t implement the code properly.

The problem seemed like a no-brainer at first, if you want to display a preview of a post Wordpress offers two options, the_excerpt() and the_content(). If you are using the_content() you have to manually insert a ‘read more’ tag wherever you need it to appear when readers are viewing the appended version of your post. I opted for the_excerpt(), which nicely and dynamically generates a brief version of an article (or an optional, manually written excerpt), along with whatever other information you decide to include along with it in the loop.

BUT, out of the box the_excerpt() adds a nifty little blob to the end of each excerpt unless you fill in your excerpt manually, looks like this [...]  Not pretty… of course there are plugins to spice up your excerpts and all that, but whenever possible I like to do a little future-proofing by writing actual code that can be baked into a theme. A little logic or some-such thing. I liked the solution I found at WP Engineer (which has conveniently disappeared, replaced by information for not-yet-released Wordpress 2.9), which when added to your functions.php file, supplants Wordpress’ own the_excerpt() functionality. Replace ‘better_trim_excerpt’ with your own name if your feeling feisty…

<?php
function better_trim_excerpt($text) {
	global $post;
	if ( '' == $text ) {
		$text = get_the_content('');
		$text = apply_filters('the_content', $text);
		$text = str_replace(']]>', ']]&gt;', $text);
		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
		$text = strip_tags($text);
		$excerpt_length = 45;
		$words = explode(' ', $text, $excerpt_length + 1);
		if (count($words)> $excerpt_length) {
			array_pop($words);
			array_push($words, '...');//'...' is what replaces the unsightly blob..
			$text = implode(' ', $words);
		}
	}
	return $text;
}
?>

Just one problem, Wordpress’s wondrous auto-generated captioning was being stripped from the resulting html, but not the content of the caption (leaving hideous random text willy-nilly). Add this bit of code to our previous solution, and problem solved..

<pre>add_filter( 'img_caption_shortcode', create_function('$a, $b, $c', 'return $c;'), 10, 3 );</pre>

which gives us the following;


<?php
function better_trim_excerpt($text) {
 global $post;
 if ( '' == $text ) {
 add_filter( 'img_caption_shortcode', create_function('$a, $b, $c', 'return $c;'), 10, 3 );
 $text = get_the_content('');
 $text = apply_filters('the_content', $text);
 $text = str_replace(']]>', ']]&gt;', $text);
 $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
 $text = strip_tags($text);
 $excerpt_length = 45;
 $words = explode(' ', $text, $excerpt_length + 1);
 if (count($words)> $excerpt_length) {
 array_pop($words);
 array_push($words, '...');//'...' is what replaces the unsightly blob..
 $text = implode(' ', $words);
 }
 }
 return $text;
}
?>
<?php
remove_filter('get_the_excerpt', 'wp_trim_excerpt');//removes wp hook for excerpt function
add_filter('get_the_excerpt', 'better_trim_excerpt');//points wordpress to yours, name this whatever you want!
?>

Having gone through all of this, today I discovered that the_excerpt() is bound for a makeover, and with the release of 2.9 two lines of code may accomplish what took me twenty-three or so. Though I’m not positive it will solve my caption problems…

Posted in Updates | No Comments »