Broken navigation in WordPress .. and one way to fix it

After upgrading my sites to WordPress 3.3, as well as updating a few themes, I noticed page navigation was broken in some of them.

Namely, the base path was repeated in the URL. Instead of using a URL such as ‘/linfa/create/page/2′ for older posts, the URL used was ‘/linfa/create/linfa/create/page/2′.

The odd thing was that the bug did not happen all the time. Some themes were affected. Some were not. And the same theme would appear broken on one computer and not on another.

I tracked down that behavior to a missing trailing ‘/’ in the URL for the Home link in a theme.

For example, if a theme is using this in its Header.php file :

<a href="<?php echo home_url(); ?>">

The link to the home page would be missing a trailing ‘/’ and would in turn break page navigation with older entries.

A solution is to replace the call for home_url by :

<a href="<?php echo home_url('/'); ?>">

The ‘/’ parameter ensures the URL is properly closed and will not break navigation.

So … check your headers and make sure your themes are updated.

Semantic MediaWiki of the month

KnowIt – home page

KnowIt, a project of collaborative enterprise encyclopedia I am working on, is featured as Wiki of the Month for August 2011 on the Semantic MediaWiki site !
[...]

Admin toolbar missing in WordPress theme

Funny how you don’t notice something is missing until you actually need it.

I realized today that the WordPress admin toolbar was missing on one of my sites, after days working on it.

Fortunately, the solution was simple in this case – wp_footer() was missing in the Footer.php file of the theme I am using (WordPress Anniversary) :

http://xbfish.com/tag/wordpress-top-admin-bar-missing/

Fixing thumbnails in single posts of Aggregate Theme

There is a possible bug in the Aggregate WordPress theme from Elegant Themes.

Thumbnails are rendered differently from single posts pages and from blog style templates. Thumbnails in single posts are using the ‘thumb’ class, are missing the white frame visible on other pages and appear broken when the thumbnail is smaller than the dimensions of the thumbnail. In addition, the size of the thumbnails is 200×200 instead of 184×184 like in blog pages.

The fixed code should go in the ‘Single.php’ file.

In short – edit ‘Single.php’ and :

  • reduce the size of thumbnail to 184×184
  • change the class of thumbnail to ‘et_pt_thumb alignleft’ instead of ‘thumb’

<?php
	$thumb = '';
	$width = 184;
	$height = 184;
	$classtext = 'single-thumb';
	$titletext = get_the_title();
	$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Entry');
	$thumb = $thumbnail["thumb"];
?>

<?php if($thumb <> '') { ?>
	<div class="et_pt_thumb alignleft">
		<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
		<span class="overlay"></span>
	</div> 	<!-- end .thumb -->
<?php } ?>

Adblocked

Note to self – when troubleshooting the display of AdSense ads on web pages, make sure AdBlock is not running in the browser !

Query multiple tags with WordPress 3.2

A small clarification when it comes to querying WordPress posts with multiple tags – tags in the URL are using Slugs …. not full values. If your query is missing items or is returning empty, make sure you are using the right value for your tags.

It is probably obvious to developers but it took me a bad attempt at multiple tags query to figure that one out.

http://server/wp/?tag=tags1+tag2 for a query of tag1 AND tag2

http://server/wp/?tag=tags1,tag2 for a query of tag1 OR tag2

Final word on MacPro crashes

No random crash since the replacement of my video card a few months ago.

Based on past observations, here is what I believe happened :

1- For some reason, the external USB drive I was using for my monthly offline snapshot backup caused random shutdowns. Looking at the logs, it seems most crashes happened right after a Time Machine backup while the external drive was plugged in (although there was no error in the logs – simply a shutdown message).

2- I also experienced sudden shutdown while playing 3D games under bootcamp (Fallout and World of Warcraft). These were related to driver and heat issues.

3- These random crashes took a toll on the video card. Which in turn, added a stream of video glitches and more random shutdowns.

I believe this cycle happened about once a year, resulting in having to replace a faulty video card each time.

Conclusions ?

- Video cards for MacPro are sensitive to sudden shutdowns and may need to be regularly replaced (which is an issue for an aging 2008 MacPro).

- Gaming on a MacPro can be hazardous for the machine itself. Better set up a separate PC for games and dedicate the Mac for more serious tasks.

Things you cannot do with an iPad (yet ?)

Two months in with the iPad 2, it is growing on me but I am still on the fence on several points.

  1. Share with anything other than Facebook, Twitter and Email. I know there are other browsers, but I haven’t found a way to make them the default browser, so you end up invariably in Safari. Many applications include a way to display web pages without leaving the app, with a subset of what any browser can do. Which brings me to #2.
  2. Copy the URL of the current page you are reading when you are using an embedded browser. Look at a page inside Flipboard, Twitter or any other app and you end up having to ‘View in safari’ and leave the app to do anything with that page, which defeats the point of having an embedded browser.
  3. Collect links for research. This is an extension of #2. There is no easy way to
  4. Write long text. The default keyboard has serious limitations – serious enough to have apps such as iA Writer create their own keyboard or to see the rise of physical keyboards embedded in cases. Which would be fine except you cannot make iA’s keyboard a default across every apps in your iPad and you have to keep taking your iPad in and out of keyboard enabled cases as they tend to be bulky.
  5. Easily switch auto-correction on and off. The clumsiness of the keyboard makes auto-correction a must (I can’t count how many times I hit ‘n’ or ‘m’ instead of the space bar). Problem is – english auto-correction is a pain when you try to type an occasional email in French. Fortunately, it is possible to add foreign options to the keyboard, but they also change the keyboard layout. A switch for auto-correction only would be more convenient.
  6. View the source of a web page. Strangely absent from Safari… you have to set up a special bookmarklet to get that option back. I know most people do not case about the source, but why hide that option since it is still obviously available.
  7. Both delete or archive emails in the Mail app. When connected to a Gmail POP account, the Mail app offers either to Archive or Delete mails. I need to have both options available so I can decide what to do after I am done reading an email. because of that limitation, I am using Gmail’s web interface instead.
  8. Plug the power adapter and change volume. The curve of the iPad’s body makes it cumbersome to insert the adaptor and find the volume and mute button. I still have to turn it over and look at the controls to see what I am doing.

 

 

Uninstall old applications

My Macbook was sluggish, freezing for about two second every few minutes or so. It was especially bad with streaming videos.

Turns out fragments of an old application (Desktoptopia) were causing a timout every few minutes.

CleanApp took care of it beautifully.

Mac Pro overheating

Twice in the last two days, I found my desktop unresponsive. The second time also had the fans running wildly. So far, everything points to something causing the CPU to overheat.

Coincidentally, I noticed the latest version of Chrome getting stuck with 100% CPU on my laptop, also running MacOS.

Google searches [1] and [2] pointed to occasional reports of Firefox or Chrome causing MacOS to run wild, most likely relate to sites running Flash.

Two steps seem to help so far – installing smcFanControl and Temperature Monitor to better control over heating and making sure I do not let Chrome running by itself when I am not at my desk, or at least, not running any site with Flash.

Let’s hope this will be enough. I am not looking forward to another cycle of troubleshooting random heat related crashes.

Update 1: Nevermind. Temperature seemed stable most of the day until I came home from dinner and found the Mac overheating yet again. Oddly – the past two overheating incident happened around that time as well…. sometime between 6:00 and 7:00 pm. Maybe another clue.

Update 2: Video card and motherboard are both dust free. Since these overheating episodes started suddenly on Friday 11th, lets start by uninstalling recent updates. First to go are Chrome and Flash.

Update 3: Getting better and better. Running the Disk Utility uncovered several issues with the disk itself, which had to be repaired after booting from the Mac OS install CD. Although the repair was claimed a success, rebooting afterwards resulted in a hard shutdown as soon as I used ‘Spaces’. Only one thing left at the moment – reinstalling MacOS and start from a clean slate.

Update 4: So much for that. Another meltdown after about a week running smoothly. I switched to Windows to see if the crashes are really related to Mac OS and sure enough, it didn’t take more than a day before another meltdown happened. Fantastic – this means I am looking at an issue with the motherboard, power supply or video card.