WordPress Post-Notification – Show the author in email subject

I was trying to fix a WordPress Post Notification plugin to include the post author in the emails subject. Instead of inserting the author name it was leaving the @@author in the subject.

A little digging around found me the solution –

In sendmail.php->post_notification_create_email(), find –

$subject = get_option('post_notification_subject');

and add a new line after that –

$subject = str_replace('@@author', $post_author, $subject); 

Ref – Post Notification forum

Moving a WordPress blog to new domain

WordPress documentation does a pretty good job of explaining the steps you have to take if you are moving your wordpress blog to a new domain.

See Changing The Site URL – Domain Name Change

Even after you update the guid in your WordPress database’s posts table by following the instructions there, you may find that some of the images do not show up, and the image and other links are broken.

Run this command to see if the problem is in the post contents in the WordPress database’s posts table –

select id, post_title from wp_posts where post_content like '%exampleoldsiteurl%';

(Replace exampleoldsiteurl with the old url of your blog)

If this shows posts that are using the old url, you need to replace that url in the post_content just as you did for guid –

UPDATE wp_posts SET post_content = replace(post_content, 'exampleoldsiteurl','examplenewsiteurl');

Make sure to carefully read the instructions on the WordPress Codex link above, and absolutely make certain that you have a back-up of your database before you run these sql commands on it.

Setting up WordPress on Ubuntu and Nginx

Finally, after thinking about it many times and never giving it a try, I moved my blog over from wordpress.com to a hosted wordpress installation.

Thanks to kind folks at mensk, the setup was a breeze.
See Perfect Setup: Ubuntu Hardy+Nginx+MySQL5+PHP5+Wordress

If you are following the instructions on that post though, be careful. The first instruction for

sudo ln -s /usr/local/nginx/sites-available/mydomain.com /usr/local/nginx/sites-enabled/mydomain.com

should be

sudo ln -s /usr/local/nginx/sites-available/default /usr/local/nginx/sites-enabled/default

Otherwise, you will get a connection refused error when you try to test just after completing the Nginx setup. Other than that, I was able to get everything up and running with minimal fuss.

This is the first time I am playing with Nginx, that was pretty cool. As soon as I have some time, I should see how well it works with Tomcat.

And, thanks to good people at jestro for writing the Vigilance WordPress theme. It is a minimalistic theme that lets you control many aspects of the blog. If you are going to customize any of the styles in the theme, make sure to read Easy Upgrading With Child Themes.

WordPress blogs – Source code syntax highlighting

Say goodbye to the code tag.
Wordpress.com blogs have a new shortcode to post source code with syntax highlighting.
http://wordpress.com/blog/2007/09/03/posting-source-code/

If you find that you can’t get it to work, make sure that you have typed in the shortcode, and not copied the snippet from the FAQ entry.

When copied, the snippet contains invalid markup. See if you can spot the difference –

sourcecode language='css']...[/sourcecode
sourcecode language=’css’]...[/sourcecode

:)