Page 7 Page 8

This is a pretty exciting time here at rhymes with milk. I’ve posted 28 posts – 29 including this one – and I have WordPress set to display 5 posts per page, making 6 total pages of posts. Follow so far?

The pagination* that I use on this site was actually created as a WordPress function by Eric Martin (I later found out it’s also a WP plugin, but I don’t think it was when I first installed it). It’s a clean and simple alternative to the default “next page/previous page” links built into WP, and makes the site much more navigable.

pagination

As you can see, there are currently 6 pages (as I already said…), and every page has its own link. When it reaches 7 pages, though, is when things get exciting. Since it’s not possible to continue linking to each individual page, the pagination ends up taking on a new, more compact form. The thing is, I can’t remember what that form is, though…

I remember testing out the paginate function when this site was still under construction by writing a bunch of dummy posts and setting WordPress to only show one per page. The function allows you to choose at what point it breaks from its current form into the more compacted one, and I remember setting that to be at page 7. I also remember customizing the compact look, but I can’t exactly remember what I customized it to.

I’m super excited to see what’s about to happen. Here’s to Page 7.

UPDATE: I have a few private posts that I never ended up posting, but still show up for me when I’m logged in. Therefore I see more pages than you do, so you all can’t see this yet, but it just rolled over to 7 for me. And guess what happened? Nothing. My memory was clearly wrong. I’m beginning to think it’s page 8 when the magic happens. Yeah, page 8, that’s definitely it. Here’s to Page 8!

* How do you pronounce “paginate”? Everywhere I look says it’s paj-uh-ney-shuh, but I refuse to believe that. Why would something originally pronounce with a long “a” suddenly change it to a short vowel sound, especially since there’s still a single consonant then a vowel trailing it? I could understand it if the spelling had been changed as well, to something like paggination, but it didn’t.

No Comments »
date May 15th 2010
author Mike
category Geek
tags
 

disqus

I’m a fan of Disqus. It’s a great commenting system, the Gravatar support is a plus, and the comment tracking they have for your profile is awesome. So a few months ago when I was still in the process of creating this blog, I installed it here on Rhymes With Milk using the official Disqus WordPress plugin.

As the process of creating this site started to wind down, I started thinking about validating my code (as any good developer would do). Essentially this just means that I check to see if the organization that governs internet standards thinks my XHTML is up to snuff. And whaddaya know, the homepage alone has over 3 dozen errors*, but none of them are errors I made. They mostly come from the code Disqus adds to the page (with most of the others coming from an embedded YouTube video).

This really rubbed me the wrong way. These weren’t simple negligible errors like “you shouldn’t have a border size declared on an iframe because that’s not allowed” (this in fact is an error on Mark’s blog — I think it’s a Tumblr thing, so give them shit for it, not Mark)** but ones like “there’s an extra link closer-outer tag for a link that doesn’t even exist.” Seriously, Disqus? You didn’t test the plugin before you launched it?

So I decided to hack it. The php files that actually define the plugin’s actions are a bit more advanced than I was prepared for (I can usually pick my way through other people’s code pretty well. Just take a look at my archives. You think those looked like that out-of-the-box? Hell no.). I Googled the problem with very low expectations (Disqus dev documentation is surprisingly scarce) but stumbled upon this gem. This blog takes you step-by-step on how to correct the invalid markup that Disqus adds to your page. Awesome, it just saved me at least 4 hair-pulling hours.

I think the post was written at least one plugin version ago because some things looked a bit different on mine than in the examples, but for the most part I was able to do just what it said verbatim. And happily it worked. My site’s validation checked out (aside from that stupid YouTube video), but for some reason I lost comment count. All posts said that there were zero comments. With my tail between my legs, I got rid of the hacked Disqus and reinstalled a factory-fresh version, complete with its terrible markup.

But not all is lost. The site doesn’t really visually or functionally “break” because of the poorly written code (at least not on good browsers), so in the short run I can ignore the validation issues. And hopefully “the short run” is all that I’ll have to worry about. 3 days ago Disqus posted this on their blog:

We’re nearing the release of our new WordPress plugin that contains bug fixes, better importing, compatibility fixes with themes and other plugins, as well as offers new improvements in performance and speed.

And one of the comment moderators (aka a Disqus employee) said that the plugin is supposed to be released this week! It feels like Christmas in the RWM household. Hopefully they get it right this time. All the way right.

* Take a look for yourself. Click here to see all the errors.

** The only reason I looked at the validation info for his site was because he also has Disqus installed on his blog and I wanted to see if it generated the same errors there, too. It does not because the Tumblr and WordPress inclusion codes are different.

1 Comment »
date Feb 22nd 2010
author Mike
category Geek
tags,
  1 Comment

Music

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

I now have audio!

This is actually a plugin (the WordPress Audio Player, which only a few days ago came out with what I hear was a much-needed update), which is something WordPress does really well (plugins, that is). Finding, installing, and activating plugins is never more than a few convenient clicks away.  But of course, as has been my luck with this theme so far, it wasn’t as easy as that for me.

After installing and activating, I uploaded the above mp3 via FTP* and created a new post with the suggested

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

insertion format. I got a big fat error saying:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Flash is up-to-date and JS is enabled, so that wasn’t the problem.  Being that this is a fairly common error message to get with this plugin, I was able to find a lot of support in the WP forums. Many people suggested adding <?php wp_head(); ?> to the head section of the blog. This somehow triggers the plugin or something, and it fixed the problem for most people.  After adding it, a bunch of new code appeared in the head section of my source code, so I was hopeful that this solved it.

It didn’t.  Same error kept coming up.

And since it fixed the problem for most people, there was little support beyond that in the forums.  I downloaded another audio player that simply loads the WP Audio Player when you click on a link, and it had no problems.  Obviously it wasn’t a problem with my browser, Flash, or even my blog.  There was a problem with how the plugin was communicating with the theme (it actually worked just fine when I switched to the WordPress default theme).  Though most complicated PHP is over my head, I was forced to dive into the plugin’s main file ([PLUGIN DIR]/audio-player/audio-player.php) to see if I could spot where the error was being triggered.

Miraculously, I was able to decipher enough to figure out that the plugin was trying to add a small snippet of code to the page’s footer.  A light bulb went off when I saw that.  While doing research on what the wp_head() function does, I noticed somewhere that there was an equivalent wp_footer() function.  I put that into my footer.php file right before the </body> tag, and what do you know? I now have audio.

Slowly but surely this blog is coming together.

*WordPress also has a really simple media-upload tool built in which I would have used, but naturally I ran into roadblocks with it as well.  My server allows max upload sizes of 2MB by default, and after some research I was told to edit my php.ini file.  Using HostMonster’s PHP Config tool, I created a new default php.ini file and edited it accordingly.  It didn’t work.  I don’t know if I just have to wait for the changes to take effect or if it just didn’t work.  I guess I’ll try this if I still can’t upload bigger files by tomorrow.

UPDATE: I just uploaded a 6MB song, so apparently editing the php.ini file worked.

No Comments »
date Jan 4th 2010
author Mike
category Geek
tags, , ,