Tag: Wordpress

How WordPress works: Infographic

Your regular Sunday afternoon infographic. File this for “stuff I’ll only really need if I’m going to build a blog/website using WordPress. Which I have, and will continue to do…

Via Mashable.

How to run two columns with different categories using a second WordPress Loop

Regular readers can ignore this post. This is for google. And in case I want to go back to running two separate columns of content on any other sites. I’ve decided to fold my curiosities category back into the regular run of the mill posts.

Pulling a category out of the main loop is pretty easy. It just takes a query posts loop with a nice and easy “exclude” command, excluding categories by their numerical ID (which you find by going to your categories page and clicking on the category and looking at the number in the URL).

Here’s the code for the loop for the main column.

<?php if (is_home()){$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-655,-4811&paged=$paged");}?>
<?php if (is_page()) {$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-655,-4811&paged=$paged");}?>

The loop for the sidebar looks a little something like this. It should produce results that give you a different output based on the page you’re looking at (so you won’t get the same ten sidebar posts on every page).

<?php if (is_home()){$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $myPosts = new WP_Query();
$myPosts->query('showposts=10&cat=11'.'&paged='.$paged);} ?>
<?php if (is_page()){$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $myPosts = new WP_Query();
$myPosts->query('showposts=10&cat=11'.'&paged='.$paged);} ?>
<?php while ($myPosts->have_posts()) : $myPosts->the_post(); ?>

<div>
<h2><a href=”<?php the_permalink();?>” title=”<?php the_title();?>”><?php the_title(); ?></a></h2>
<div>
<em>Posted by</em> <?php the_author_posts_link(); ?> </div>

<?php the_content();?>

How to actually get the Facebook “Like button” working on WordPress without a plugin

This is a post about how to code stuff in WordPress. If you’re a regular reader who doesn’t care about this stuff, just skip it. I won’t be offended.

I’ve spent so many hours frustrated at this. I scoured the web for “how to” articles, and none of them actually solved my problem… so here is the solution I’ve sued to get the “like this” button working on all of my posts on my blog in both the index.php page and in my own second loop in the sidebar…

The iframe version of the like button worked really easily – it was only the FBML button I had problems with (which has cooler features). I couldn’t figure out how to get the FBML Facebook Like option to work on WordPress without using a plugin. I don’t like plugins (if I can code it myself).

Here are the steps I took that I think solved my problem (I will try adding some things I removed back in to see if they break what I’ve done).

Step 1. Remove any “Facebook Share” plugins or code already in your posts. I read on one of the plugins that it might clash with preexisting Facebook code.
Step 2. Set up your “application” on Facebook.

In the set up options go to the “Connect”… make sure you put your URLs in the “connect” page.

I suspect, though I’m not sure, that you need to choose the FBML option on the Canvas page.

Step 3. Now you need to put some code in your header.

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:og="http://opengraphprotocol.org/schema/"
xmlns:fb="http://www.facebook.com/2008/fbml">

And this…

<meta property="og:site_name" content="YOUR BLOG NAME"/>
<meta property="og:title" content="<?php the_title_attribute( '' ); ?>"/>
<meta property="og:type" content="blog"/>
<meta property="og:image" content="THE URL TO THE IMAGE YOU WANT PEOPLE TO SEE ON FACEBOOK"/>
<meta property="fb:app_id" content="THE APP ID NUMBER FROM FACEBOOK (SEE BELOW)"/>

For example:

<meta property="og:site_name" content="St. Eutychus"/>
<meta property="og:title" content="<?php the_title_attribute( '' ); ?>"/>
<meta property="og:type" content="blog"/>
<meta property="og:image" content="http://st-eutychus.com/wp-content/themes/whiteplus/images/headertitle.png"/>
<meta property="fb:app_id" content="116899985006841"/>

Step 4. Insert the SDK code. Go to your footer.php and stick this block of code in before the you close your body tag (</body>)... this is the JavaScript SDK thing that Facebook talks about here – it allows you (because it’s in your footer) to call the “like” function from any page that uses your footer. Make sure you put your app ID in the spot that says YOUR APP ID.

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: 'YOUR APP ID',
xfbml: true
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>

Step 5. Insert the Like Button Code. Facebook’s default “like button” code won’t help you much if you want the address for individual posts to be sent through to your profile (and hopefully those of your friends when they like what you’ve written. You need to change the URL option to call the post’s permalink. Facebook will generate you a block of code that will give you options like having your friends photos appear when they like your post and stuff. I don’t want that. Put this where you want the like button to appear. Here’s the code I used:

<fb:like width="340" height="30" layout="standard" show_faces="false" href="<?php the_permalink() ?>" colorscheme="default"></fb:like>

There may be something to factor in depending on how your link structure works – some other posts I read had a couple of extra options around the permalink)… they use something like this: <?php echo urlencode(get_permalink($post->ID)); ?>

10 WordPress Plugins I love

I love WordPress for much the same reason that I love Firefox (and almost the same reason that I love the iPhone – except that it’s not Open Source). Plugins. Plugins make the world go around. There are 8070 WordPress Plugins in existence today. That’s a lot. They do a lot of stuff.

I’ve found ten that I will install on any blog or website I build using WordPress – and I’m planning to use WordPress for any blog or website I build ever. A few of them do almost exactly the same thing. But I keep them installed as a permanent testing phase for cool things I can use elsewhere.

These aren’t in order of usefulness or importance. They’re all good. I’ve left off all the popular ones that everybody should install straight off the bat (the Akismet spam filter, WP-Super Cache, and anything SEO related (I use this one)). These are the fun ones that make your life easier and your blog better.

  1. Post Highlights – The little box on the right of my homepage with nice pictures and a link to an old post is produced using this plugin, there are a couple of options that do the same thing – but this one didn’t clash with a couple of my other plugins. So I installed it.
  2. Sexy Bookmarks – The little icons at the bottom of each post which let you share my work with the world via a bunch of popular bookmark services come courtesy of this baby. They look nice. I like them. I’d like more people to press them.
  3. Shashin – I installed this last weekend. It’s a great Picasa to WordPress plugin. It’s really easy to use.
  4. Insights – this bad boy lets you search old blog posts with ease while you’re creating a new post. It means if I want to link to something I’ve written a long time ago I don’t have to search through the archives using the site search feature and then copy the link… it also lets you search other blogs, for videos, for images (from Flickr), for News, Wikipedia articles and books…
  5. IntenseDebate – I know some people hate my comment platform. But it’s the way of the future – and you can just deal with it or get on board. IntenseDebate lets you link your comments to your Facebook Profile, Twitter Account, IntenseDebate Account, or just your website. It lets people rate your comments. It has its own plugins. And it lets you embed YouTube videos into your comments. I like it.
  6. Sliding Panel – has anybody ever hit the little thing that says “open” in the black menu bar at the top of the page? No? Oh well, if you had you would have found a really cool jquery powered sliding panel. It looks nice opening and shutting. I could just sit there and do it all day.
  7. Twitter Tools – When I decided to re-enter the world of Twitter I did it using this plugin that has so many features that I’m unlikely to use. But its core functionality is also really useful. Especially if you’re like me – and want the benefit of posting your content onto Twitter without the hassle of actually visiting the site.
  8. Wibiya Plugin – You can never have too many options to let people share or search your content can you? Wibiya is the little bar that sits on the bottom of the page. I’ve had it installed for ages. I’m not sure that anybody actually uses it. But if you bothered you’d be surprised at how handy it is.
  9. Post Star Ratings – This puts the stars at the bottom of the posts so that you can tell me if you like, or don’t like, what I’ve written without having to navigate the commenting system. It’s similar to I Like This except that giving a post one star is a way to voice your displeasure.
  10. What would Seth Godin Do – I like the idea of converting people who land on a post via Google into people who subscribe to everything I have to say. So I installed this plugin that welcomes first time visitors with a nice little message and an invitation to subscribe.

Do you use WordPress already? Have you got any favourites that aren’t on the list?

Sharing is caring

Because I like experimenting with just about every feature you can add to a website (this may well come in handy one day when someone asks “how can I get people to be able to share my stuff on Facebook without copying and pasting a link”) I’ve added a little “share on Facebook” button to the top right of each post. This is pretty cool. It lets you post stuff you like straight to your profile so that all your friends can also read it. And it keeps track of how many times something has been shared. If there is no little speech bubble above the button with a number in it it’s because nobody has shared the link.

Here are four reasons you should click the “share on Facebook” button.

  1. It will make me feel better about myself.
  2. It will make the number change.
  3. It will get more people coming to this page who will then click the button to make me feel good.
  4. Those people will think you’re brilliant and capable of finding all sorts of funny things on the Internet. You can vicariously benefit from my dedicated procrastination.

I don’t know how long I’ll keep it. But I haven’t culled any of the other plugins or things I’ve installed to get more people here – even if I’m the only person who clicks and shares my stuff. It’ll be depressing if things only ever get shared once (especially if that once is by me) so at that point I might remove it. But seriously, without trying to clamour desperately for your attention, how hard is it to click on a star (you don’t even have to like the post to do this), and click on a button once in a while?

If you are reading this, and you have a Facebook profile (which you need to be able to share the post on Facebook), and you’re not a fan of St. Eutychus yet – then do yourself me yourself a favour and get on board the juggernaut.

Photographic Memories

I had a little victory today. And I want you to know about it. If you’ve ever scrolled all the way to the bottom of the page here on the blog you may have noticed five Polaroid style pictures. Up until now three of them were the same photo, and the other two didn’t ever change. But no longer. With some coding wizardry and the help of Shashin – a great little Picasa plugin – these five slots will now be filled with five different random images from a Picasa album.

Very exciting.

I’m pretty happy with my efforts.

Here’s a sample.

Star status

Simone has demanded (and installed) a “like function” to operate as a middle ground between casually enjoyment and making a comment.

I like it. I found a “star rating” plug-in for WordPress. I installed it. Now it’s your turn. You need to rate my posts (1 star to 5 stars) as you see fit. Otherwise I’ll just rate them myself and I’ll turn into a five star blogger.

This also meets Simone’s need for a “dislike” option. Because lets face it. Nobody wants one star.

Page turner

Woohoo. After a fair bit of frustrating experimenting with php I’ve got the “older posts” link to actually display older posts, rather than just the same 20 posts that appear on the front page. Now I just have to get the sidebar behaving correctly… But now I have a headache.

My Desk

WordPress has a widely reported glitch with third party posting software that strips angled brackets – < – these things – from incoming posts. So you didn’t get to see the photo of my spectacularly messy desk that I used in the test post before. So here it is. In all it’s glory. I can find most things on it when I need to…

mydesk003.jpg

Today’s linkage February 5th

Best of the interweb

From the desk of: other people

One of the things I really enjoy about blogs is being able to draw on the collective wisdom of people trailblazing a path that we plan to head down in the not too distant future. At the moment I’m enjoying a bunch of blogs from students currently studying at theological college.

I’ve subscribed to Bathgates.net for quite a while because Dan (who doesn’t blog enough) kept sharing really interestng posts from it via google reader. I like it’s style – that is to say I really like Ben’s style. He’s got a great post at the moment full of tip for people embarking on theological study. It’s well worth a read. One of the sad things about using a RSS reader to get all your content is that you lose the really nice design work people have done on their blogs.

Another absolutely superb design (it really is stunning and functional) – matched by great content and the longest,  most philosophically deep “about me” page I’ve ever read – can be found at Dan Anderson’s papermind – I know Dan in real life (or IRL for you internet people). He’s a top bloke and is currently considering the purpose of studying  philosophy while studying theology. The discussion is written in a style somewhat representative of Sophie’s Word – although the protagonists are a pair of slightly distracted philosophers. Worth a look thus far. Dan was also kind enough to add my blog to his blog roll so I’m responding in kind with this little plug. Did I mention that I really like his design? I do. WordPress is aesthetically quite pleasing.

Milestones

Interesting fact – while importing my blog into WordPress (I’m still toying with making the move but am thinking it needs to be done properly to a wordpress.org site rather than a wordpress.com blog) I noticed that today I hit 300 posts, and 2000 comments. My comment to post ratio is still reasonably good – but most of them are from posts a while ago. That seems worthy of some sort of celebration. I think I’ll go home and play some Bomberman on the N64 which arrived in the mail today from eBay.