Posted Post

Posted People, Posted Life.

Archive for WordPress

Simple Fix Dagon Design Form Mailer Cannot Send Mail in WordPress

For default, there do not have a Form widgets in WordPress, so I use Dagon Design Form Mailer, very easy to use.

Ok, I am not introduce you the form mailer here, I met problem indeed. I use the mailer for get email, the problem is, no matter how hard I try, how many settings I change, there is just no mail arrive my box. :( Read the rest of this entry »

Fix Weird Wordpress Relative Path Problem

After update Wordpress to 3.0, I noticed some weird server-relative path appear in the post source file, for example:

<a href=”./tag/something/”>something</a>

And it should be ( and always before update), a absolute path like

<a href=”http://postedpost.com/tag/something/”>something</a>

It’s strange and hard to notice because the relative path works fine in the blog site itself, but, but it will mess up the code at third party, like feedburner code etc. Read the rest of this entry »

WordPress mu Sitemap Files: postedpost.php

Check WordPress Mu Google XML Sitemap Solution for what this file is about.

Filename postedpost.php, placed into mu-plugins folder. Please note, if you have any other code or hacks, you can put all code together, for increase performance. Read the rest of this entry »

WordPress mu Sitemap Files: sitemap-ui.php

Check WordPress Mu Google XML Sitemap Solution for what this file is about.

File name sitemap-ui.php, a modified version of Google Sitemaps Generator (from verison 3.1.0.1) Read the rest of this entry »

WordPress mu Sitemap Files: sitemap-core.php

Check WordPress Mu Google XML Sitemap Solution for what this file is about.

File name sitemap-core.php, a modified version of Google Sitemaps Generator (from verison 3.1.0.1) Read the rest of this entry »

Wordpress Mu Google XML Sitemap Solution

After download the Google Sitemaps Generator, I thought it might easy to install on Wordpress mu system. But I am wrong, not that simple, I have to change lots of place to make it useful. Here is what I do and why:

First thing first, install:

Install the sitemap generator is same as install any other plugin, unzip and put it into plugin folder, like:

\wp-content\plugins\google-sitemap-generator

I am not put it into mu-plugins folder, because I do not want sitemap.xml for all blogs, I need give blogger choice, they can active it when they need sitemap. (Not everyone like sitemap IMO) Read the rest of this entry »

Ultimate WP Post Name URL Sanitize Solution

Few days ago, I was not satisfied with the ugly URL of some post, so I hacked “sanitize_title” function. After I said that time, I also not satisfied with super-long URL and want short them. After short WP category permalink structure today, I put more hacked code in sanitize_title function for short URL. Anyhow, shit happens and I noticed sanitize_title function also used almost everywhere, special when normal visitor visit and process the URL. I don’t want to explain how this mess up, just forget it.

So, I need new method of short and nice URL for article post. I need find a place for “apply_filters” or “do_action“, after quite long time track from /wp-admin/post.php, finally I found at sanitize_post_field function, $value = apply_filters(”pre_$field”, $value); to pretreat all submit data.

Here is my filter: Read the rest of this entry »

Single "Category Permalink Structure"

What is SINGLE “Category Permalink Structure”?

Here is an example:

One of my blog category URL looks like this before:
http://fashion.postedpost.com/category/fashion-house/accessories/ties/

After single it, it will look like:
http://fashion.postedpost.com/category/ties/

Why we need shorter category permalink?

  1. Shorter is better, you know, size is always an issue.
  2. Change categories structure anytime without change urls
  3. Avoid duplicate content issue, because both of URLs are display a same webpage.

How to do it.

Find category-template.php in WordPress wp-includes folder, find this function: function get_category_link($category_id)

Comment the following lines:

//if ( $parent = $category->parent )
// $category_nicename = get_category_parents($parent, false, ‘/’, true) . $category_nicename;

(or get a plugin if you like)

Hack WordPress "sanitize_title" Function

I use English as title only, recently I noticed some of my blog post has “%” in url (e.g.) or too too many dashes “—” in url (e.g.). !!!!! (2008/6/23 .. forget this method, check Ultimate WP Post Name URL Sanitize Solution)

So unacceptable. So I check the wordpress code and update the following:

function sanitize_title($title, $fallback_title = ”) {
$title = strip_tags($title);
$title = preg_replace(’/&.+?;/’, ”, $title); // Kill entities
$title = preg_replace(”/[^a-z0-9]+/i”, ” “, strtolower($title)); // Remove all non-english and non-number code
$title = trim(preg_replace(”/ {2,}/i”, ” “, $title)); // Remove extra space
$title = apply_filters(’sanitize_title’, $title);
if (empty($title)) {
$title = $fallback_title;
}
return $title;
}

at “formatting.php”.

Next thing: I serious think about shorter very long url (the post_name is varchar(200) in database)

Updated Blogs

Alexa CounterFeedBurner Counter