Archive for the ‘Discovering WordPress’ Category

WordPress Thumbnails in Archives Page: making it work

Friday, September 2nd, 2011

The attack of the insomnia has hit again, so I’m taking this advantage to update the Top Commentators Widget (which is now in 1.5-beta and downloadable via WordPress Extend if you wanna try it out — this blog is currently running it) as well as a couple of my favourite niche sites.

One niche site I own, Cross Stitch For Free, displays the archives of its posts together with its respective thumbnails. These thumbnails are generated automatically by the Ordered Thumbnails plugin, which scans the post for any image and uses the first image it finds as the default thumbnail.

Since WP 2.9, thumbnails are built into the core, which means that I don’t have to rely on any plugin in order to generate it. All I had to do was add a few codes in my functions.php and archive.php, and that supposedly should do the trick.

Unfortunately, it wasn’t as simple as that. But it ain’t too complicated, either.

I followed the exact same steps as told in the WordPress Codex, which was to add the add_theme_support()theme function in the functions.php file, and the_post_thumbnail() in the archive.php file (making sure the function is within the Loop). But nothing showed.

After an hour or so researching the Web, I was finally able to guess why. I needed to edit each post, then go toAdd an Image > Gallery or Media Library if the image isn’t attached to that particular post, Show the image to expand its options, and, most importantly, click Use as featured image. And I needed to do this for every single post I want a thumbnail to appear in.

"Use as featured image" WordPress thumbnails in archive.php

I suppose it’s fine if you don’t have that many posts in your blog as in my case, but if you already have hundreds, then best of luck to you. I believe there may be a few WP plugins out there that may help solve this problem, but I didn’t bother trying it out. My niche blog only has close to 70 pages, and I’m already finding it tedious to manually set them one by one. You can see the difference yourself; view the first few pages of the archives and then see how the last two pages of the post archive look like without the thumbnail featured image being set (scroll to the end of the page and find the last two page numbers you see).

In any case, it’s always good to utilise the core hooks of WordPress rather than relying on plugins, if you’re comfortable hardcoding your blog templates. They’re faster, more reliable, and safer.

Share

Top Commentators Widget mini update (v.1.4.2)

Thursday, February 24th, 2011

A quick heads-up on the latest TCW update, in line with the release of WordPress 3.1. This update also addressed the comment hijacking issue that, while wonderfully suggested and fixed by Stuff by Sarah quite a while ago (and implemented by yours truly on v.0.999a) , were not fully effective in blocking the comment spammers. Basically it’s a small rewrite of the database query, that’s all. This means that v.1.4.2 won’t affect your >=TCW 1.4 settings in any way.

Nevertheless, Top Commentators Widget v.2.0 update, to coincide with the next WordPress update (whether major or minor), will again affect your setup.

  1. The form control, i.e. what you see in the Widgets section, will be re-arranged to simplify it.
  2. Further modification on the look of your Number of Comments will be enabled.
  3. Styling of the list for CSS purposes will be improved.
  4. Addition of DIV on top of Numbered and Ordered.

I like WP 3.1. Do you?

Share

Urgent update: Top Commentators Widget v.1.4.1 beta

Wednesday, February 16th, 2011

IMPORTANT: If you have customized the styles in any way on this widget, be aware that this update may break them!

Fingers crossed, this version of TCW (downloadable in WP.org’s plugin repository) should address all of the problems encountered in v.1.4 as mentioned in the comments of my previous post (especially those disappearing settings / changes in form not committing). I honestly THANK YOU for your comments – you have no idea how I appreciate all those bug reports you all have given.

The widget has gone through a heck of a major rewrite between v.1.4 and this one, so what does this really mean for your blog?

  1. This version and any future updates of the Top Commentators Widget will no longer be compatible with WordPress installs prior to version 2.8. Sorry, folks, it’s just to inconvenient to make it backward compatible.
  2. TCW is finally using the widgets API available since WP 2.8, which means that 1.4.1 beta now supports multiple instances of the Top Commentators in your blog!
  3. Due to the support for multi-instances of this widget, the ID and CLASS styles may be called differently. You may not notice much difference especially if you’re only using a single instance of the Top Commentators widget in your blog, but you need to be aware of this in any case.

If you don’t feel at all comfortable with the changes in v.1.4 and this one, the older versions of this widget is still available at the WP.org repository; just find the link at the sidebar named “Older version” and grab the version that fits your blog.

Version 1.4 is so unstable, that I’ve decided to label this update as a beta. However, please feel brave enough to at least install this version in your sandbox and let me know how it goes in your blog. Please please please let me know, working or not, I would really like to know.

The TCW may be deactivated from your Widgets list due to the new API calls it makes. Therefore, once upgraded, please make sure you revisit your Widgets page and re-do your settings, then Save them.

I’d better give my back a rest. This slipped disc injury is scarily painful; I hope I’ll gain full mobility soon. My home and my kids are a wreck without me.

Share

WordPress Top Commentators Widget v.1.4

Saturday, February 12th, 2011

If you have issues with the latest update (v.1.4), keep those feedback coming; please add them in the comments section below. I am currently working on the fix as of this moment.

The latest version is up at WP.org’s plugin repository. As mentioned in the README file:

  1. Added the Award option which will display image or icon of a medal/badge once a commentator reaches a certain number of comments determined by blog owner.
  2. Modified the form to allow default values to be entered automatically when initialized (i.e. widget’s Save button is pressed).
  3. Added support for setting default Gravatars to 404, Mystery Man, Identicons, MonsterIDs or Wavatars.
  4. Repaired the query statement for filtering e-mails.

screenshot-3

Thanks to Konsti for the award/gaming suggestion. For now it only takes into account a single range. Hopefully in the future the widget can scan based on how active a commentator is, then award these users based on different levels of comments contributed.

Change number 2 is mainly for those who’ve complained that the top commentators wasn’t showing even after the widget is installed. Remember to go to the Widgets option, add the TCW in, and click the Save button to initialize its values. The widget won’t display anything if you do not press the Save button and get those default values entered into your WordPress options database.

A year ago, user iferg requested that the TCW supports other default Gravatars like Identicons, MonsterIDs and Wavatars. I finally had a chance to read up on this, and added that option into this widget.

Last, but not least, user ostin654 contributed a fix to the e-mail filtering bug, so I really appreciate that!

If you would like me to keep updating this WordPress plugin, I would like to ask just one thing from you – if you have a bug and/or a fix to report, or if you have modified the codes in any way that would benefit the TCW users, please share it with us. I’ll be sure to credit you and add those modifications in the next update. This would be the best way to continue making Top Commentators Widget useful and fun to use.

Please skip the rest of my post below; these are just notes to self so that I’ll remember how to update the TCW repo next time.

For new projects

  1. Create a new folder in your computer.
  2. Download and install TortoiseSVN.
  3. Right-click on the new folder and select SVN Checkout.
  4. Set the WP.org repository URL and WP.org login info.

To edit code

Change the stuff under the Trunk folder within the new folder you created.

To update code

Right-click on the new folder or the Trunk folder itself, and select SVN Commit to check the files in. Add in the message “Version #.#” in the message section.

To tag code

  1. Create a new folder within the Tags folder, naming it with the same version number as your current HEAD/trunk.
  2. Copy all files in Trunk and paste it in the Tags folder with the version number.
  3. Right-click on the Tags folder and select SVN Commit.
  4. Add in the message “Tagging version #.#” in the message section for housekeeping purposes.
Share

The Top Commentators Widget and Subversioning

Sunday, January 23rd, 2011

I am way behind schedule on the TCW update, I know (and thanks for reminding me, Konsti!). Yes, I’m actually done with the changes – 3 of them, in fact – and I am ready to put it up into TCW WordPress.org’s Extend at latest by tomorrow.

I got to be honest here. My delays are almost always (99.99% of the time) caused by two things – one: finding the time to do some coding, and two (a more embarrassing fact): I have little to zero clue how to use Subversion.

I know, right?! How could I, after more than three years developing TCW, still not get a handle of using it? More shameful is the fact that I’m a programmer by trade. Boo me.

It was suppose to be easy, this check-out, edit, commit, check-in thing. There’s a myriad of how-to posts specifically on using TortoiseSVN for WordPress.org. And I’m a programmer, for heaven’s sake! I should know code versioning!

The truth is, I’m a solo programmer and I don’t have to share my code with anyone. So all I needed to do was to create a new folder and dump my latest codes in there. That’s my versioning. Even if I did need to use versioning, it ‘ssuppose to be as easy as using Google Code.

So why is it that every time I tried to commit using Subversion, it Just Didn’t Work ™? I didn’t see the change in trunk to the latest version number. My changelog sometimes reflected the change in WP server, then suddenly I didn’t see it anymore. Went through the steps again, from1 to 10 (or 11, or 20… I lost count of the many how-to I followed).

After nothing seemed to work, I went off the beaten path, and tinkered those options out of frustration. Then suddenly, Eureka! It’s there in WP.org, my latest version of TCW in all its glory! My heart sings Hallelujah as I typed down what I’ve done the best I could, hopeful that whatever I’ve typed would become my next blog post on my stagnant WebGrrrl blog.

But alas. This problem feels like a nasty cycle of procrastination and/or forgetfulness and/or carelessness. Take your pick.

You’ve read my previous post on how “active” I was these past couple of years. So tonight, I shall once again go through the process of committing my latest Top Commentators widget update, typing those steps again into a draft post, crossing my fingers and hope that this time, that post won’t disappear into thin air and I’ll not only have the latest TCW up for you, but also my next Post Of The Week ready for primetime viewing.

BTW, here are some blog posts from WebGrrrl.net readers who are taking on the PostAWeek 2011 challenge:

Share