Archive

Archive for the ‘Wordpress’ Category

Weird Timezone Issues in WordPress

July 18th, 2011 No comments

Here’s a throwaway WordPress post for you.

Recently, our comments started having weird timestamps. Like, 4 hours in the future to be exact. What was happening was that instead of ‘local time’ being used, WordPress (or maybe Disqus) was using ‘UTC’ time. UTC time is 4 hours ahead of local time, so that seemed to be it. Not sure what caused it, but the most recent PHP 5 build was June 30, so that could be it.

Anyhow, to fix it, edit your wp-settings file and look for the following line:

date_default_timezone_set(‘UTC’);

You have two choices: change UTC to its descriptive locale like this (use the locale where you reside)

date_default_timezone_set(‘America/Phoenix’);

Or use the UTC offset like this:

date_default_timezone_set(‘UTC -7′);

That’s it. Test it out by commenting to yourself in the most lonely way possible and then check the comment timestamp and see if it’s using local time.

Optimal Title Plugin No Longer Needed In WordPress

May 14th, 2011 1 comment

Every time I see an article with a title like 5 Essential WordPress Plugins, or 10 WordPress Plugins That You Can’t Live Without, the Optimal Title plugin is always in the list.

What this plugin did was move the separator so that your blog title would appear after the title of your blog post. This is good practice in the pseudo scientific world of writing with SEO in mind. Have a look at the title bar of your browser right now. See how the title of this post comes first, and the blog name (Big Fat Ostrich) comes second? Search engines like that, and the search results are clearer to the person obtaining them.

However…

I only recently discovered that WordPress has actually had this functionality since WordPress 2.5, or from around 2008! When anyone decides to put together a website using WordPress, they’ll invariably run a search for “best WordPress plugins“, and end up using a list of plugins from 5 years ago. This is why it’s important to check on the development status of any given plugin. Here at BFO, we’ve learned this lesson as well. However, if you look at the download stats for Optimal Title, you’ll see that it’s still being downloaded on a regular basis. You’ll also see that it hasn’t been updated since 2007.

Optimal Title was actually an excellent plugin that filled a need that WordPress couldn’t pre version 2.5. Since WordPress now has the separator argument built in to the wp_title() function found in header.php, you just need to make a small change in your header.php file.

It may depend on which WordPress theme you’re using, but the format below works for us. Many new themes actually use the search optimized title formatted correctly so you won’t need to do anything.

<title><?php wp_title(‘&raquo;’,TRUE,’right’); ?><?php bloginfo(‘name’); ?></title>

 

Fatal error: Allowed memory size of 33554432 bytes exhausted … Yeah!

October 12th, 2010 No comments

Has this ever happened to you. In WordPress?

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 14016 bytes) in foo.php on line 895

Well it totally can happen and here’s what you can do to fix it.

First of all, the error is related to PHP, and it happens when…you’re out of memory! In the above error, I can pretty much guarantee that your memory limit directive in your php.ini file is set to 32M. But how do you check? Here’s an easy way.

Create or touch a file in public_html called phpinfo.php. Edit that file and put the following in it:

<?php
phpinfo();
?>

Now browse to http://www.yourdomain.com/phpinfo.php and it’s all there! Everything you need to know about your php directives and shit.

Now look for the “memory_limit” directive. Does it look like this:

memory_limit = 32M

If it does, you probably want to change it to this:

memory_limit = 64M

You need to have access to your php.ini file. If you don’t know where to find it, once again, look at your phpinfo.php page we just made. And look for this:

Loaded Configuration File

It probably has a path like /usr/local/lib/php.ini, or maybe it’s something different. Wherever your php.ini file is, edit it and look for the memory_limit directive, and change it to the following, like I said above.

memory_limit = 64M

And that’s it! Now all your problems should be solved. Except maybe for the one about making this month’s rent. Goddamn it!

iNove theme: How to display number of posts per category

April 4th, 2009 1 comment

By default, the iNove wordpress theme (yes, the simple yet slick theme you see here) doesn’t display the number of posts in each category. You may like it that way, but I decided to find out if there was a way to enable them. Turns out you can, and it’s as easy as apple pie. With ice cream.

Head on over to your trusty wp (WordPress) theme editor, and edit sidebar.php. Then search for the categories section. This is the block of code you’re looking for:

<!-- categories -->
<div class="widget widget_categories">
<h3>Categories</h3>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=0&depth=1'); ?>
</ul>
</div>

All you need to do is change optioncount=0 to optioncount=1 so that the php line looks like this:

<?php wp_list_cats('sort_column=name&optioncount=1&depth=1'); ?>

Save it and you’re done! It’s so simple, I feel like I’m forgetting something.

Enjoy

Related Posts with Thumbnails