Blog, Design, Wordpress•
on February 16th, 2010•
I read an interesting article about Companies Are Dropping IE6; Vendors follow accordingly.
While Internet Explorer 6 collapses in the enterprise, Internet Explorer 8 is picking up fast:
“Current data from the exo.repository shows a dramatic spike in IE 8.0 adoption, with over 70% of Windows XP systems – sampled from the exo.performance.network’s IT-centric community of nearly 23,000 registered sites – now running Microsoft’s latest web browser. This compares to the less than 10% of XP systems that are still running the aging IE 6.0, and the roughly 20% who are stuck on the in-between version, IE 7.0.
As a web developer, i thought IE6 was a great player in Browser world, when no competitor could match IE at that time. But now, IE6 is a pain for any web developers. It’s the only browser with problems could make it different from other browsers. I give you an easy example, PNG transparancy. PNG has became a popular format for images on current Interwebs world, still IE6 can’t handle it right. If you see pixert.com in IE6, there are bugs need to be fixed
It makes sense for developers to drop IE 6 and move on with those reasons. Google Apps did it, why can’t we? It will make our job easier, painless and happier
However, some clients still need it? why ?
It is same reason with Socialtext, “as much as we would like to move beyond IE 6, we have enterprise-wide security-conscious customers that still require supporting it for their users. These are valuable forward looking customers for whom we must be backwards compatible ”
Whether i like it or not, there are 10% use IE6 on their systems. I’m offering web services, that something I can’t ignore yet until it drops to less than 5% or it cannot hold to new web standards, HTML5 and CSS3.
Blog, Wordpress•
on February 7th, 2010•

P2 is a theme from Automattic (WP mothership) team that transforms a mild-mannered blog into a super-blog with features like inline comments on the homepage, a posting form right on the homepage, inline editing of posts and comments, real-time updates so new posts and comments come in without reloading, and much more (as written on P2′s website
)
wp.me is a shortURL service from Automattic. Matt, father of WordPress said “it’s a short link, about 70% smaller than the permalink for this post. WP.me is the only two-letter .me domain in the world.Every blog and post on WordPress.com has a WP.me URL now. These are all exposed in the using rel=shortlink. It doesn’t work for any URL in the world, just WP.com-hosted ones. The links are permanent, they will work as long as WordPress.com is around.WP.me is spam-free, because we are constantly monitoring and removing spam from WP.com”
Automattic added Get Shortlink to WordPress,where is it exactly? Matt said a ‘Get Shortlink’ button next to your permalink when you edit or write a post, and when you click it you’ll get a popup with the beautiful link already highlighted for your copy and pasting pleasure.
Back to P2 idea, i found P2 is a great theme to communicate between team members or company employees, It has in-front UI for add/edit posts, reply comments, however no Get Shorlink?
I had an idea to add wp.me or Get Shortlink to P2 theme in early January. No wp.me shortlink tool in that theme at the time (or still ?) I spent amount of time for a fun modification
Install WordPress.com Stats plugin or known as wp stats plugin
After that, lets get our hands dirty with code
1. Open entry.php and add
if ( function_exists('get_shortlink') ) : <a rel="shortlink">Shortlink</a> else : endif;
Add it below
[phpif ( current_user_can('edit_post', get_the_id() ) ) :[/php]
This means you only use that when you logged in.
Why did I add Shortlink only for logged in users? because that show Shortlink in same area with Edit Post, when you click Edit, it will pop-up editor box below content in P2.
2. Add a function to show Shortlink in AJAX way
Open inc folder, edit ajax.php. Find line no 5, where the class P2Ajax is. Add below function inside class P2Ajax {
function get_shortlink_ajax() {
check_ajax_referer('ajaxnonce','_inline_edit');
if ( function_exists('get_shortlink') ) :
$post_id = $_GET['post_ID'];
$post_id = substr( $post_id, strpos( $post_id, '-' ) + 1 );
echo get_shortlink($post_id);
else :
endif;
}
3. Last step is the most difficult step. I added a function for AJAX but it wont work with step 3.
Still in same folder, that’s inc folder, now open p2.js
Go to line 406, where you see this code
<blockquote>case "post" :
var thisPostEditArea;
if (inlineEditPosts != 0 && isUserLoggedIn) {
thisPostEditArea = $(element).children('div.editarea');
thisPostEditArea.editable(ajaxUrl, {event: 'edit',loadurl: ajaxUrl + '?action=prologue_load_post&_inline_edit=' + nonce,
id: 'post_ID', name: 'content', type: 'autogrow', cssclass: 'textedit',rows: '3',
indicator : '', loadtext: p2txt.loading,
cancel: p2txt.cancel, submit: p2txt.save, tooltip : '', width: '90%', onblur: 'ignore',
submitdata: {action:'prologue_inline_save', _inline_edit: nonce}});
$(element).find('a.post-edit-link').click(function() {
thisPostEditArea.trigger("edit");
return false;
});
}
Add below code after above lines,
<blockquote>var thisShortLinkArea;
if (inlineEditPosts != 0 && isUserLoggedIn) {
thisShortLinkArea = $(element).children('div.editarea');
thisShortLinkArea.editable(ajaxUrl, {event: 'shortlink',loadurl: ajaxUrl + '?action=prologue_load_post&_inline_edit=' + nonce,
id: 'post_ID', name: 'shortlink', type: 'autogrow', cssclass: 'textedit',rows: '3',
indicator : '', loadtext: p2txt.loading,
cancel: p2txt.cancel, tooltip : '', width: '90%', onblur: 'ignore'});
$(element).find('a.shortlink').click(function() {
thisShortLinkArea.trigger("shortlink");
return false;
});
}
Go to line no 488, change
</strong>
<strong> </strong>
<blockquote>if ((inlineEditPosts || inlineEditComments ) && isUserLoggedIn) {
to
<blockquote>if ((inlineEditPosts || inlineShortLink || inlineEditComments ) && isUserLoggedIn) {
Go to line no 558, where you see this code
<blockquote>if (inlineEditPosts && isUserLoggedIn) {
$('div.editarea').editable(ajaxUrl, {event: 'shortlink', loadurl: ajaxUrl + '?action=prologue_load_post&_inline_edit=' + nonce,
id: 'post_ID', name: 'shortlink', type: 'autogrow', cssclass: 'textedit', rows: '3',
indicator : '/>', loadtext: p2txt.loading, cancel: p2txt.cancel,tooltip : '', width: '90%', onblur: 'ignore',});
$('#main a.shortlink').click(function() {
$(this).parents('li').children('div.editarea').trigger("shortlink");
return false;
});
}
Add below code after above lines
<blockquote>if (inlineEditComments && isUserLoggedIn) {
$('div.comment-edit').editable(ajaxUrl, {event: 'edit',loadurl: ajaxUrl + '?action=prologue_load_comment&_inline_edit=' + nonce,
id: 'comment_ID',name: 'comment_content', type : 'autogrow', cssclass: 'textedit', rows: '3',
indicator : '>', loadtext: p2txt.loading, cancel: p2txt.cancel, submit: p2txt.save,
tooltip: '', width: '90%', submitdata: {action:'prologue_inline_comment_save', _inline_edit: nonce} } );
$('a.comment-edit-link').click(function() {
$(this).parents('h4').next('div.comment-edit').trigger("edit");
return false;
});
}
Open folder js, edit p2.js.
Go to line no 472
<blockquote>var thisPostEditArea;
if (inlineEditPosts != 0 && isUserLoggedIn) {
thisPostEditArea = $(element).children('div.editarea');
thisPostEditArea.editable(ajaxUrl, {event: 'edit', loadurl: ajaxUrl + '&action=get_post&_inline_edit=' + nonce,
id: 'post_ID', name: 'content', type: 'autogrow', cssclass: 'textedit',rows: '3',
indicator : '', loadtext: p2txt.loading,
cancel: p2txt.cancel, submit: p2txt.save, tooltip : '', width: '90%', onblur: 'ignore',
submitdata: {action:'save_post', _inline_edit: nonce}});
jQuery(element).find('a.post-edit-link').click(function() {
thisPostEditArea.trigger('edit');
return false;
});
}
Add below code after above lines,
<blockquote>var thisShortLinkArea;
if (inlineEditPosts != 0 && isUserLoggedIn) {
thisShortLinkArea = $(element).children('div.editarea');
thisShortLinkArea.editable(ajaxUrl, {event: 'shortlink', loadurl: ajaxUrl + '&action=get_shortlink_ajax&_inline_edit=' + nonce,
id: 'post_ID', name: 'shortlink', type: 'autogrow', cssclass: 'textedit',rows: '3',
indicator : '', loadtext: p2txt.loading,
cancel: p2txt.cancel, tooltip : '', width: '90%', onblur: 'ignore'});
jQuery(element).find('a.shortlink').click(function() {
thisShortLinkArea.trigger('shortlink');
return false;
});
}
After that, go to line 614, where you see this code
<blockquote>// Bind actions to comments and posts
if (inlineEditPosts && isUserLoggedIn) {
$('a.post-edit-link').live( 'click' , function() {
$('div.editarea').editable(ajaxUrl, {event: 'edit', loadurl: ajaxUrl + '&action=get_post&_inline_edit=' + nonce,
id: 'post_ID', name: 'content', type: 'autogrow', cssclass: 'textedit', rows: '3',
indicator : '', loadtext: p2txt.loading, cancel: p2txt.cancel,
submit : p2txt.save, tooltip : '', width: '90%', onblur: 'ignore',
submitdata: {action:'save_post', _inline_edit: nonce}});
$(this).parents('li').children('div.editarea').trigger("edit");
return false;
});
}
Add below code after above lines,
<blockquote>if (inlineEditPosts && isUserLoggedIn) {
$('a.shortlink').live( 'click' , function() {
$('div.editarea').editable(ajaxUrl, {event: 'shortlink', loadurl: ajaxUrl + '&action=get_shortlink_ajax&_inline_edit=' + nonce,
id: 'post_ID', name: 'shortlink', type: 'autogrow', cssclass: 'textedit', rows: '3',
indicator : '', loadtext: p2txt.loading, cancel: p2txt.cancel,
tooltip : '', width: '90%', onblur: 'ignore'});
$(this).parents('li').children('div.editarea').trigger("shortlink");
return false;
});
}
View P2 with Get Shortlink demo (it also uses Private Only plugin)
Username: user01
Password: 123456