tags:

views:

275

answers:

2

Hi all,

Firstly, I'm not fresh faced with WordPress, I've been actively using it for various light-weight custom CMS since the early 1.x line.

I'm using a fresh build of 2.8.6 for a very, very simple blog build. Only one category and only one 'single' template. There's no other functionality, so the site only really requires the index.php and single.php files in the theme directory.

The issues: the_author() does not work on single.php, and only works partially on index.php. By partially, I mean the tags works for the first item in the loop, but then doesn't work thereafter.

wp_get_archives() shows no content in the sidebar, even though there are 14 test articles in the blog back-published to May of this year.

Description of the error: The mysterious lack of 'echo' from these tags does not halt the loading of the page. My CSS template displays fine (and it is not CSS hiding anything). The tags simply are presenting no output to the screen.

Remedies I have tried: I've tried using get_userdata() with the post author, but even this doesn't work. I can get the post author_id from the database ($post->author_id), but get_userdata() doesn't return anything when fed this variable on single.php or for any posts after the first in the loop.

I've also tried all the standard tracing solutions such as print_r() and trying to get the function to return a variable to analyse it's contents - no luck.

If anyone has any idea at all what could be causing this, please do get in touch! I've never had silly issues with WordPress like this before. Thanks.

A: 

Found out what was going on (ish).

I'm using a custom PHP class to provide some additional functionality that I reuse in a lot of places. This class uses it's own database connection, and for some reason when mysql_close() is called, it terminates the calls made by the_author() and wp_get_archives().

Could probably work around this using $wpdb, but not sure how much hassle it'd be to integrate this.

Anyway, hope this helps someone else out.

Aaron
A: 

In that case have your class use $wbdb->dbh for its connection handle. That way only one db connection is open and is shared between WordPress and your class.

Gipetto