Stop WordPress from Removing br and p Tags

WordPress has a bad habit of removing or reformatting br and p tags that are entered into posts and pages. It also does some other funky formatting that can be annoying at times.

Well, here’s a way to fix this issue.

Go into the theme editing area of WP admin. Add this code to your functions.php file, and save it.

<?php
function my_formatter($content) {
	$new_content = '';
	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

	foreach ($pieces as $piece) {
		if (preg_match($pattern_contents, $piece, $matches)) {
			$new_content .= $matches[1];
		} else {
			$new_content .= wptexturize(wpautop($piece));
		}
	}

	return $new_content;
}

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

add_filter('the_content', 'my_formatter', 99);
?>

Now, when writing a post/page, use [raw][/raw] tags to surround that parts of the post/page that you do not want formatted.

WordPress 2.5.1 Upgrade: Changed Files 2.5 to 2.5.1

Disclaimer
I cannot stress the crtical importance of making a full backup of your files and database before attempting to upgrade WordPress. Mistakes do happen, and things do break. Both are shortly followed by you banging your head and cursing. Save yourself the headache…Backup first, then upgrade! 🙂

I should also mention that these files are being downloaded directly from the WordPress Trac system. I did not package the zip.

WordPress 2.5.1 was released.

Here is a zip of the files changed from WordPress 2.5 to 2.5.1.

WordPress – Best of Breed

It’s a simple as the title of this post…”Best of Breed”. When it comes to online blogging applications, WordPress is Best of Breed.

It’s free! But that does not make it great, just easily accessible.

It has a huge following! Have a WordPress question? It’s answered in a couple hours on their forum. Need some advanced help? You can find easily a WordPress pro online in minutes. Need some special feature? There’s a very good chance that someone else as already had that need too. You’ll likely find that there is a plugin already written for your feature.
Continue reading WordPress – Best of Breed

Is your WordPress .htaccess file causing problems with other files?

That’s the issue I ran into. I was building a WordPress site, and put a billing/invoicing app in a subdirectory of the site.

Well, the default rewrite lines (that WordPress added to the site’s htaccess file) were causing major issues for the billing script (AWBS). It was also causing problems with Apache password protecting of a directory. The WordPress rewrite would take over before Apache would invoke the username/password entry box.

It was a big mess. I spent a long time pulling my hair out over the situation.
Continue reading Is your WordPress .htaccess file causing problems with other files?

SpyFu Discount Code

Want to see which keywords your competitors are buying on adwords? That’s exactly what SpyFu does.

As a participant in their beta testing program, I received some SpyFu Discount Codes that are good for the lifetime of your subscription. I have one left. So whomever gets it first can use it! It must be initially used before July 2nd 2007 though.

From the SpyFu Email…
Continue reading SpyFu Discount Code

Setup an IDN in WHM/CPanel

I recently ran across a question where the user wanted to setup an IDN (Internationalized Domain Name) in WHM/Cpanel. For those wondering, an IDN is a domain name that uses non-ASCII characters, such as ñ, ü, ý, etc. I learned that the process to setup such a domain in WHM/Cpanel is quite simple.

To setup the domain in WHM, you first need to convert the IDN domain name to Punycode. For example the non-ASCII domain name “xn--fsher-kva.com” converts to the punycode version, “xn--fsher-kva.com”. Once you have the punycode version of the domain, you’re set to go. Just make sure account username does not use punycode or any non-ACII characters. Just use plain ASCII characters for usernames. Continue reading Setup an IDN in WHM/CPanel