Archive for May, 2011

WordPress the_excerpt() strips html tags, create a custom function to leave them in

Friday, May 27th, 2011

go to your theme’s function script:

wp-content/themes/yourthemename/function.php

at the top insert the following (add to ‘<img>’ below to NOT strip out other specific tags, or simply comment the line out…):

function improved_trim_excerpt($text) {
global $post;
if ( ” == $text ) {
$text = get_the_content(”);
$text = apply_filters(‘the_content’, $text);
$text = str_replace(‘]]>’, ‘]]&gt;’, $text);
$text = strip_tags($text, ‘<img>’);
$excerpt_length = 55;
$words = explode(‘ ‘, $text, $excerpt_length + 1);
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, ‘[…]’);
$text = implode(‘ ‘, $words);
}
}
return $text;
}
remove_filter(‘get_the_excerpt’,’wp_trim_excerpt’);
add_filter(‘get_the_excerpt’,’improved_trim_excerpt’);

some references: http://codex.wordpress.org/Function_Reference/the_excerpt, http://www.aaronrussell.co.uk/blog/improving-wordpress-the_excerpt/

Create a Facebook App

Thursday, May 26th, 2011

first visit facebook and register your new app:
http://www.facebook.com/developers
configure the facebook settings to point to your server

grab the facebook php library:
http://github.com/facebook/php-sdk/tarball/master
or here:
developers.facebook.com/resources.php

upload your application’s new index.php to your server, something like this:

<? php
require_once ‘facebook.php’;
$appapikey = ‘1234’;
$appsecret = ‘1234’;
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login(); $html = ‘PUT YOUR HTML HERE’;
$facebook->api_client->profile_setFBML(NULL, $user_id, $html, NULL, NULL, $html);
echo ‘<br /><fb:add-section-button section=”profile” />’;
? >

it’s that simple.

references:

http://www.youtube.com/watch?v=roOYZKsN3Yg
http://www.merchantos.com/blog/makebeta/facebook/facebook-php-tutorial

Dreamweaver Remember and re-open documents when closed

Tuesday, May 24th, 2011

Are you wanting to close Dreamweaver,
and work on that task tomorrow,
but you have all of the files that you need open,
and you don’t want to find them all and have to open them all again?
Do you want Dreamweaver to remember which files were open,
and open them all again for you?
(Something that is default, by the way, in something like Zend Studio, enough said…)

Preferences:

Edit | Preferences | General | Document Options: Reopen documents at startup

WordPress convert podcast from Podpress to Powerpress support HTML5 mobile devices

Thursday, May 12th, 2011

If you found this post, you think you’re stuck with Podpress, and/or you’re wanting to make your podcast viewable on mobile devices.  I was in the same boat until just recently, stuck with a podcast I’d initially setup with Podpress years ago, support for which has been worryingly spotty and dwindling, wishing I could now ditch Podpress, but I had over 160 posts I didn’t want to convert….

What I didn’t realize is that the creators of Powerpress had exactly that in mind when they developed Powerpress!  All I had to do was install Powerpress, activate it, ensure that it’s settings were correct, and then deactivate Podpress, and bam, it worked. SO AWESOME, highly recommended.

So I can successfully declare today, that I’ve migrated now 3 podcasts from Podpress to Powerpress, one with 84 posts, one with 164, another with 11.

  • The feeds are unaffected, Feedburner is completely unaware of the change
  • views/layouts unaltered
  • I didn’t even need to go back into the posts and alter the data, Powerpress simply interprets it
  • iTunes unaffected
  • Powerpress serves up the flashplayer if the requesting browser support flash, and theL HTML5 audio or video player if it doesn’t, enabling by many versions of the iPod, iPad, Android, and so on, handled, done!
  • HUGE win.