Archive for the ‘WordPress’ Category

I’ve installed the plugin Facebook Connect and it works great. One thing I wanted, though, was a smaller connect button to put on the sidebar. So here are the hacks I made.

In the /wp-content/plugins/wp-facebookconnect directory edit fbconnect.php. Locate the function “fbc_display_login_button”. Copy the entire function and paste it beneath the original one, renaming it “fbc_display_login_button2″. Change the line…

$button = render_fbconnect_button();

…to…

$button = render_fbconnect_button2();

…and change…

echo <<<EOF <div $visibility id="fbc_login">
 <span><small>Connect with your Facebook Account</small></span>
 <br/> $button </div>
EOF;

…to… 

  echo <<<EOF <li id="fbc_login">$button</li> EOF;

…and save it.

Next edit common.php and locate the function render_fbconnect_button. Copy it and make a duplicate just beneath it named render_fbconnect_button2. Now make the following changes to the new function.

Change…

  return <<<EOF
 <div>
   <fb:login-button size="large" background="white" length="short" $onlogin_str>
   </fb:login-button>
 </div> EOF;

…to…

return <<<EOF
   <fb:login-button size="small" background="white" length="short"
 $onlogin_str v="2">Login/register with Facebook
   </fb:login-button> EOF;

…and save the file.

We’re still not finished.

If you don’t use widgets, then you simply have to add…

<?php fbc_display_login_button2(); ?>

…in the sidebar.php of your theme beneath the login (the login will look like…

<?php wp_loginout(); ?>

However if you use widgets, then it’ll be more difficult. What I did was edit wp-includes/default-widgets.php and located the class WP_Widget_Meta. I then added the…

<?php fbc_display_login_button2(); ?>

…just below the…

<?php wp_loginout(); ?>

Make sure you backup all the files your editing, both the original and the updated versions, because A. if you mess up you’ll need the original and B. once an update of WP or the plugin occurs, you’ll need to make the changes all over again.

To continue…

6. WP-CodeBox. This is one I wish I’d found earlier. It allows a nice display of code for blogs that offer programming tips (like this one). I added an updated a few entries to use the code, and it’s really nice.

7.  BuddyPress. This one is not for everyone, but it has a lot of features. In essence it turns your blog into a solcial networking site. The basic look is kinda ugly, so a redesign would be needed, but if you wanted to offer some of the social networking features of Facebook or MySpace to your blog, this will allow you.

8. Google XML Sitemaps. Very important for search engine optimization.  It should reduce the bandwidth required by search engines to spider your site, which is always a plus.

9. Automatic Upgrade. Something that will be really handy. The documentation claims that it…

  1. Backs up the files and makes available a link to download it.
  2. Backs up the database and makes available a link to download it.
  3. Downloads the latest files from http://wordpress.org/latest.zip and unzips it.
  4. Puts the site in maintenance mode.
  5. De-activates all active plugins and remembers it.
  6. Upgrades wordpress files.
  7. Gives you a link that will open in a new window to upgrade installation.
  8. Re-activates the plugins.

10. GD-Star Ratings. Not only will this help you know which posts people like, it just looks snazzy.

It was tough finding the right plugins, because older plugins are still being promoted across the web, which may or may not be of any use. Some offered features which are now standard in the latest versions of WP. Some, apparently have been purchased by WP to be in corporated in later versions. But, here are the ones I found, which include many I’ve installed for clients.

1. WP-Optimize.  This is very handy in cleaning up the mess left from WPs database usage. It can optimize the tables as well as clean out unused drafts. I’ve installed this on clinets’ web sites.

2. WP to Twitter. This one will tweet your latest post to Twitter, but will require your Twitter login and has an optional cl.gs API function that would also require that API key. I haven’t tried it, but was considering writing one that did this, so its usefulness is obvious.

3. Sociable. Until I’m able to package up the social links I did for some clients, this would probably be the next best thing.

4. WP-FacebookConnect. I haven’t tried this, and apparently no one else has and verified that it works. It’s obviously needed, and is the only one I could find. I have clients asking for this functionality, so I’ll be testing it, and if it doesn’t will need to build one.

5. Facebook Dashboard Widget. Also a handy one, if it works.

More and more people are using their smart phones to access the internet, which obviously includes blogs. So it’s important to make sure your blog is mobile friendly.

When researching I was surprised to find that while WordPress had a nice selection of plugins, apps and other options for making blogs mobile friendly, Movable Type had very little. So for today we’ll just discuss WordPress, and maybe in the future I can outlines some options for Movable Type, which would probably require some behind the scenes scripting to work.

My mobile phone is an iPhone, so it’s tempting for me to assume everyone else has one, too. Be that as it may, there is a handy iPhone app, http://iphone.wordpress.org/, for managing your WordPress blog via your iPhone.

The plugin I’ve found most useful is WPTouch. I just installed it here, and have used on several clients’ blogs. Unfortunately it only works for iPhones.

For other phones you’d need the WordPress Mobile Pack. It catches all the other types of phones (and both plugins can run simultaniously).

I’ll also note the iPhone Interface for Movable Type, which is a plugin you can install to allow you to manage your MT blog via your iPhone, but apparently doesn’t provide a mobile frontend for your MT blog.

There’s a simple way and a hard way to do this. The hard way also adds a shortened url, allowing the reader to include more of the headline in the 140 characters twitter allows.

First the easy way.

WordPress…

<a href="http://twitter.com/home?status=<?
the_title('','',FALSE);
?>%20<?
the_permalink();
?>" target="_blank">re-Tweet this</a>

Movable Type…

<a href="http://twitter.com/home?status=
<$MTEntryTitle$>%20<$MTEntryPermalink$>
" target="_blank">re-Tweet this</a>

Now the hard way involves going to http://bit.ly/pages/tools/developer-tools/ and joining. Get your API Key and username. Then create the following PHP file (you can name it whatever you want, but just remember the name, because we’ll be using it). Make sure to replace [bitly username] with your bitly username and [API Key] with your bitly API Key.

<?
$link=urldecode($_GET['l']);
$title=urldecode($_GET['t']);
$rtData=implode('',file("http://api.bit.ly/shorten?
version=2.0.1&longUrl=$link&login=
[bitly username]&apiKey=[API Key]"));
$out=json_decode($rtData, true);
$results=$out['results'];
$articleLink=$artData['article_link'];
$myLink=$results[$articleLink];
$shortUrl=$myLink['shortUrl'];
header("Location: http://twitter.com/home?
status=$title%20$shortUrl");
exit();
?>

Once that’s created with the correct username and API Key, save it to your server in a location reachable from the web. Let’s say you save it at http://myserver.com/retweet.php. We’ll then use the following for out links.

WordPress…

<a href="http://myserver.com/retweet.php?t=<?
the_title('','',FALSE);
?>&l=<? the_permalink();
?>" target="_blank">re-Tweet this</a>

Movable Type…

<a href="http://myserver.com/retweet.php?
t=<$MTEntryTitle$>&l=<$MTEntryPermalink$>
" target="_blank">re-Tweet this</a>

This then will take the title and url, convert the url into a shortened url and make your twitter status look something like this…

How to make a "Retweet this post" link http://bit.ly/ddmFZr
About me

I've been developing web sites for over 12 years. I started with HTML, moved on to Perl and now do mostly PHP with a lot of MySQL and Javascript as well.

The purpose of this blog is to write about many of the simpler scripting solutions bloggers are either unaware of or unable to implement. Hopefully I'll have something you can use

Danny Carlton

Advertising
Advertising

Switch to our mobile site