Creating a “forum” – showing last post or last commented post

You can add the standard taxonomy joins to the query: global $wpdb; $cat_id = 79; // Whatever. $sql = ” select wp_posts.*, coalesce( ( select max(comment_date) from $wpdb->comments wpc where wpc.comment_post_id = wp_posts.id ), wp_posts.post_date ) as mcomment_date from $wpdb->posts wp_posts JOIN $wpdb->term_relationships AS tr ON wp_posts.ID = tr.object_id JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id … Read more

using same mysql user with many databases

Well it’s really not good practise, but this depends on how you’re accessing the other databases. For example, I have a server that hosts 10+ different WordPress sites. I have two options for connecting to the databases: Use the root login in all my wp-config.php files as it’s easier Create a user and logins associated … Read more

MySQL database gives blank page (white screen of death)

From the looks of it, you should be changing the pre-existing urls from /www.mypage.no to /localhost The /var/www is part of the file path normally (though i suppose you could potentially set the server up that way…), so more than likely wordpress thinks it is at /var/www relative to the web root instead of /. … Read more

How can I work on a database along side a client?

You’ll need to make some modifications to wp-config.php. Add the following so WordPress picks up the domain automatically based on the environment: define( ‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’] ); define( ‘WP_HOME’, ‘http://’ . $_SERVER[‘SERVER_NAME’] ); Now we need to make WordPress a little more portable by having it determine which host to use based on which … Read more