Skip to content

{ Category Archives } Website

Fixing WordPress Gallery for Posts Page

For some reason, the style elements that WordPress insert into the code, right before a gallery is displayed was screwing up slightly. When the post was shown on its own single page, the images looked fine; when shown in a posts summary page when other posts had galleries too (and hence, more style elements within the code) the .gallery-item width seemed to be affecting all galleries. Even when I’d specified two columns in the gallery shortcode, the width was coming up as 33%.

In case I was just being dumb, I made the following hack in wp-includes/media.php, just to clarify things. Firstly, I wanted each gallery to be defined by the post ID it was in. Line 659 was changed from:

<div class='gallery'>");

to:

<div class='gallery gallery-$id'>");

I then increased the specificity of the CSS, so that other galleries didn’t inherit the width attribute. Line 646 changed from:

.gallery-item {

to:

.gallery-$id .gallery-item {

After that, the posts page was working as I thought it should! I don’t know of any drawbacks with this hack, or whether it’s actually needed (CSS inheritance means that the original code should have worked). It could even be extended so that all selectors within the style element is narrowed in specificity to just affect the gallery-$id but in this case, it was only the width attribute that seemed to be broken for me.

WordPress 2.7 Enable Threaded Comments

Having recently upgraded my WordPress installation to the funky new 2.7, I thought I’d try and hack the comments.php template so I could make use of the built-in threaded comments. I took a read of this useful article detailing the steps to alter the template file, and did everything it asked (or so I thought!).

I’d set the new comment loop up, added the microID filter, and added the enqueue script bit to the header.php (although, I couldn’t get it to show). I couldn’t get the damn thing working, even when I tried added the script reference direct to the header file.

It wasn’t until I found the almost identical article on the WordPress Codex that I noticed the following statement:

With the new code that links to the JavaScript functionality of WordPress 2.7, the new features on the Settings Discussion SubPanel will work.

Ah, nuts. A couple of extra settings had been added that I’d obviously missed when I casually glanced around the 2.7 installation. I turned these on, and hey presto, I could now see the Reply link in each thread. The above statement had also been in the original guide too, but I’d seemingly glazed over that part :(

Care to contribute?

Although this is primarily a site about me and my thoughts, I’d be interested in exchanging some guest posts with other bloggers. I think it’s good to have different bloggers on one site, to keep the interest going. It also, obviously, allows shameless plugging back to the author’s own site, thereby potentially increasing their traffic.

The topics you’d be able to write about for me would be of a non-personal nature (knowing what happened to your Uncle Dave last week may not even interest me, let alone my readers), but otherwise just about anything goes (within reason of course). Politics, web development, hobbies, sports, health, religion, technology, science, etc. are all fair game.

I’m happy to write about any topics you suggest. This is purely experimental from me and it may or may not be something to continue.

Anyway, if you’re interested in exchanging posts, let me know in the comments to this post, and if you include your correct email address, I’ll contact you shortly to work something out :-)

Site Tweaks Part 1 - Entrecard

This is the first of a five part Site Tweaks series. I’d been wanting to improve the popularity of my site, and the series covers five of the things that I’ve tried to do just that.

I’d recently joined up to Twitter, and one of the tweets I received from Reena was regarding her using Entrecard. I did a bit of research and found that Entrecard is a money-free way for bloggers to advertise their site. It works like this:

  • You’re given some initial Entrecard Credits.
  • You earn credits when you “drop” on an Entrecard widget on someone else’s site.
  • You earn credits when someone drops on the widget on your site.
  • You earn credits when someone wants to advertise their site the widget on your site.
  • You spend all these credits on advertising your site on someone else’s widget on their site.

There is also an Entrecard Shop where you can buy all manner of things (from website designs, to t-shirts, eBooks, etc) with your credits. Other users treat it exactly like currency, and offer it as prizes in competitions, or for those who are their “top droppers” for a particular month.

The widget is a piece of JavaScript that any owner of a website can add to their page. As this site runs from WordPress, I just added the snippet of code to the sidebar, so it’s always visible.

My Entrecard Drops

My Entrecard Drops

You can drop your card 300 times per day, a maximum of once per day per site. This involves you being logged into Entrecard, then going to another users site, where there widget will now say “Drop”. I had an initial splurge on the first couple of days, and dropped over 200. I did get some reciprocal drops in return indicating that users were visiting my site, even if they weren’t reading much on it. This highlights one of the fundamental issues with Entrecard - those that might be termed spam droppers. They show up on your site, find your widget, drop their card, and away they go. The Entrecard site says something about it being an opportunity for readers to find sites they like, and to continue reading it in the future, rather than just being an advertising medium.

I then had a period where I didn’t drop as many (see my drop chart), and I felt that all the work I’d put in previously for Entrecard was a bit wasted. I hadn’t yet started advertising on other people’s widgets so I wasn’t sure what traffic this would bring.

Clicks on my advert

Table of clicks on my advert, and the cost per click

Since then, I’ve had my widget appear on other sites, and yes, Entrecard, if nothing else, brings traffic. As you can see from the figures, some sites were much better at bringing a few people over than others (although, as with any statistics, these can be easily manipulated by other users).

The really valuable thing to consider however, is the number of visits vs the cost of the advert. The cost of adverts work on a power of 2 line. So a site with no other adverts queued up costs 2 credits. If it already has one advert showing (each advert lasts for 24 hours), then the cost to add your ad to the queue is 4. If there’s 2 adverts, then your cost is 8, and so on. I find the cost for others to advertise on my site sit at around 32 or 64 credits, meaning there’s 5-6 days of adverts constantly in my queue. It also means that the number of credits I have goes up by 32 or 64 each day, even if I don’t drop on other widgets, and if no-one drops on mine. Some users though are earning 1024 or 2048 credits for each advert they show!

As for getting the most out of it, I came up with my top 8 factors that affect how successful an Entrecard campaign is. I can say for certain that Entrecard is making the number of unique visitors jump up by about 20%. How targeted these visitors are, how interested they are in my site, and how likely they are to continue reading other articles is questionable.

I get the feeling that to really make Entrecard work for you, you need to spend a little bit of time every day doing drops, than do a huge number of drops one one or two days, then nothing for the rest of the week. Currently, whilst personal life is busy, I can’t really justify spending that time as I’m not as committed a blogger as others are. If my advert queue dropped to 16 or 8 credits, then I’d probably do stuff to boost my visibility with Entrecard users, to restore the plateau I’m happy with.

Top 8 factors for your Entrecard campaign

I’d bought some Entrecard ads on other sites recently, but didn’t get many clicks from them. I sat down and worked out what the reasons could have been and came up with a few ideas. Here are a list of factors that you should consider, to help reduce the cost-per-click and increase how successful your campaign is:

  1. Position on the screen - If their website has the widget “below the fold” (meaning a user has to scroll down to see it), then your advert is less likely to be seen. Try and advertise on those sites where the widget is close to the top, usually top left or top right.
  2. Speed of the site - Some users are only there to drop cards, and will only re-visit sites they know are fast loading, at least for the EC widget part. If you can find out which of the sites are fast loading, and get an advert on there, then your advert will be seen by many more people.
  3. Neighbouring Elements - Even if the widget is situated near the top of a fast loading page, if it’s surrounded by other adverts, or is hard to distinguish from other attention-grabbing elements on the site, then your advert is less likely to be noticed. Pick a site to advertise on where the EC is their main (only?) form of advertising, so that your advert will stand out more.
  4. Popularity of the site - This can be tricky to measure. On EC itself, the popularity for a site is defined by how many drops the site received the previous day. Great, you think, lets advertise on the one with the highest number of drops! Be aware however that drops can only be done by other EC users; a non-IT-related non-blogging site with a low EC popularity, may actually have considerably more visitors to their site than a blogging site - it’s just that the latter has a higher percentage of visitors from the EC community. Of course, if your own site is about EC, then the above reasoning is annulled.
  5. Cost of the advert - A more expensive may lead to a few more clicks, but the real value is in the cost-per-click table you can find on the Statistics page of your EC account. I’ve yet to establish with buying lots of cheap adverts that may get a couple of clicks each is better value for credit than splashing out on a more expensive advert to get a whole load of clicks. Either way, just remember that a more expensive advert only means it already has more adverts lined up. You may do well to watch the cost of an advert on your chosen site over the course of a week or two, to see what the high and low values of it are, then buy an advert when it hits a low again.
  6. Cost per popularity - One of the things I started checking was that you can high EC popularity sites, with low advert costs. Taking the above points into account, this means you can find a site that has lots of droppers, but won’t cost a lot for you to advertise on. I took a very rough ratio of 4:1 - if the popularity of the site was over 4 times the cost of the advert, then this was definitely worth looking into. Of course, if other factors make the site suitable to place an advert there, then a smaller ratio would be fine. You can find these good deals by searching for cheapest, setting your maximum, then ordering by most popular first.
  7. Your advert - Quite simply, if your advert looks interesting, and catches the attention of the reader, then they are more likely to click on it. Lets just say that an image of an attractive looking female will probably grab the attention of the majority of male readers.
  8. Topic of the site - Advertising your gardening blog on a site about computer games probably isn’t going to be targeting your potential readers very well. Some people prefer to advertise on a variety of sites, whilst others prefer to only target comparable sites within their own topic. Remember that advertising on a site that is about Entrecard itself, is one way of targeting other EC users.

Change of feed address

As part of some site improvements I’m doing, I’ve now employed Feedburner to keep track of how my RSS feed is doing. If you’ve subscribed therefore, please change the feed address from http://garyjones.co.uk/feed/ to http://feeds.feedburner.com/garyjones. The existing address will still work (and it’s what Feedburner itself uses), but the new feed will be enhanced with extra bits (as well as giving me a way of getting some stats). If you’ve got no idea what that all meant, then just ignore it!

As you may have noticed some other changes to the site, I’m preparing a five part series on those changes to explain what I’ve done, and why I’ve done them (and hopefully, if they’ve been successful or not).

Some template fixes

For a long while now, the meta data (posted date, number of comments, category, tags, etc.) have been missing from the posts index page at http://garyjones.co.uk/blog/ and I could explain why. I’d tried editing the “Main Index Template” plenty of times, but nothing was working.

I knew that WordPress had a number of fall-back templates, if certain files weren’t available, but wasn’t sure where to find this info, or how it could help.

My problem was two-fold: I’d got myself confused between the homepage of the site, and the homepage of the blog. Part of this template fall-back feature, is that WordPress checks for a {pagename}.php file before trying other templates. Unfortunately, I’d named the root homepage to home.php, but had set the Post Page to be Blog, but use this Home Page template to be the template of the Blog page! So confusing!

The solution was to have a read of the following, taken from the Template Hierarchy page, and then unscramble my file names, template names, assigned page templates, and the front page displays in the Reading Settings so that there was no confusion.

WordPress Template Hierarchy

Once this was done, then I could add in the correct meta data to the correct template, while not adding it to the root homepage. I still need to fill in the big blank space however…

I also added in the Popularity Contest plugin code - this is a percentage value of how popular the page is, compared to the most popular page, based on a score from permalink views, homepage views, feed views, comments etc. As the original plugin gives a fatal error in WordPress 2.6, I used a hacked version which works perfectly.

Now I’ve got a better idea of how the templates work, I can sort out the development area sometime in the future, so that the templates in use there are less scrambled too!

RegExp’s - just like Marmite

Regular expressions are not everyone’s cup of tea. I recently started using a plugin for WordPress called Download Counter Advanced, and it works great for my Battrick stuff. I wanted an easy way to add in the date so that I could put “…downloads since…” and have the date automatically insert, all marked up correctly.

I hacked the plugin code, and managed this, and out of courtesy, sent the code to Andy Staines, the author of the plugin, via his contact form. This was his reply (emphasis mine):

Ah… um… thanks!

The shocking truth is that I don’t read regexp’s! I read that chapter three times and quickly concluded that I would prefer to gently flay myself with an old dressing gown while standing naked in the snow than try to follow the rules.

My son helps me out here who is known as a RegExp king. So can you confirm what your random sequence of numbers and letters below actually does in detail as it always looks to me like it was typed by a monkey swaying gently under the influence of Prozac…

It doesn’t help that I have had only about four hours sleep only to be rudely awoken by a barking dog. So I am not thinking clearly yet. So - you pass in the data row of the download? And get back the start date?

Andy

Review: hReview WordPress Plugin

In a previous post, I’d mentioned that I’d installed the hReview plugin, but then deactiviated it due to “problems”. A comment from the author of the plugin, Andrew Scott, asked what those problems might be, and I realised that I simply hadn’t given the plugin a fair go before dismissing it. Below is my review of hReview (marked up as a microformat *using* hReview, naturally), though my styling could do with a tweak.

hReview WordPress Plugin

product

hReview WordPress Plugin does the job well

The plugin installs fine, and activates without a problem. It appears on the Write Post page as either a star or the word “hReview” (depending on if you use the visual editor or not). Selecting the star/hReview brings up a dialogue box where details of the review can be entered in. Comparing it to the hReview specs, I can see that it does cover most of the items, although some of the optional bits are missed out.

Screenshot of using the plugin to write a review

When I first used it, I’d tried using the type option to specify a product. In the visual editor this just came up as a single word in a paragraph of it’s own. Now a word is not a paragraph, so perhaps this should be marked up as a span instead. Looking at the code view, I can now see that some inline styles had been applied so that the paragraph was set to display: none; anyway. Now I know I can hack the plugin, or my own CSS, but I would prefer this word to be in a span, capitalised, with a colon, before the item name - so in this review it would have said: Product: hReview WordPress Plugin. Other types would have the same effect. Simply having (optional) data included in the source for the sake of a microformat, yet not displaying it visually is kind of against the microformat principles.

Using the dialogue box, once the content of the review has been inserted into the post editor, adding more content means looking in the code view and working out which bit you want to edit. This is fine if you have any idea about HTML, but may be scary if you don’t. Clicking the star/hReview button again brings up a blank new review box, rather than being able to edit the first review. Perhaps clicking the star should bring up the existing review, but have a button on the dialogue box for a new review (a form reset button in effect).

Lastly, part of the spec mentions the use of dtreviewed, reviewer and license. These are optional data that can be included with an hReview. Sadly, the current plugin doesn’t cater for these, which, although they are optional, may be important to certain reviewers. Ideally, the dtreviewed could be added to the post date (the specs do suggest this), and the reviewer could be added to the author data, marked up as a hCard (the specs say parsers should look outside the hReview if a reviewer can’t be found inside the review). Of course this would mean adding it into the WordPress templates, which may or may not be possible via scripting the DOM. Alternatively, settings on the dialogue box would be better and solve the problems above, as the reviewer may not be the poster, and the review date may not be the posting date. A drop down list of common licenses should also be available - those who know what they are can use it, or it can be optionally left blank.

Overall, the plugin does the job it claims to, and I admit that my previous comments were unfair (I’ll go highlight it in that post shortly). It would be nice if the Operator / Tails Firefox addons offered support for hReview, and perhaps the author of hReview may wish to contribute to those as well.The Operator addon does offer hReview support, although this hReview wasn’t detected due to what I believe is a small bug in the plugin - see the comments. If you intend to carry out reviews of any sort, and use WordPress, then the hReview WordPress Plugin from Andrew Scott is for you.

My rating: 4.0 stars
****

Web Projects

I’ve got so many web projects on the go at the moment, it’s difficult to keep track of them!

  • This very blog - I’ve recently changed themes, and it needs updating to fit in with how I want it to look. In fact I eventually want to turn this whole garyjones.co.uk site into something that’s run completely with WordPress.
  • MNNC.net has recently had WordPress added to it, so that as part of the re-design, I can use WP as a CMS. I’m supposedly using Basecamp from 37 Signals to keep track of the project.
  • For the Battrick game I play, I’ve developed some resources that have become popular within the BT community. I eventually want to integrate it more into the rest of this blog site with WP, as well as still develop the resources that exist.
  • The Battrick site itself could do with some front-end code updating, so instead of moaning about it, I decided to do some investigations and tests to offer comprehensive examples and feedback on how the site could be improved.
  • My Development section is another section I want to add to integrate into WordPress. Lots of template customisation needed, along with some CSS, so I can keep my code examples.
  • Leovanna.co.uk is my Dad’s site that I built, but we now want WordPress to run the whole site, but only look like it’s running the news section. Some templates and static pages will help with that, once I’ve worked out exactly what I’m doing with the MNNC.net site. I’ll also need to find some suitable plugins too.
  • I had an “epiphany” this morning, as Katie called it, and thought of a new tool that I would find useful for myself. I often review websites to give constructive criticism on how they can be improved, and this webReviewer tool (I haven’t got the cheek to call it webReviewr in Web 2.0 style) would allow an easier way of writing it up, as well as giving reminders of areas to check. I’ve drawn out some ideas, but not produced anything yet.

If I can get all these done by the time we head back to the UK, I’ll be pleased, but I don’t want to spend all my time here doing them, however much I enjoy it all!