Archive for the ‘WordPress’ Category

WordPress’s perfect implementation in studio site: Ovisualize

10.06.2008 by Denis - 0 Comment
Posted in WordPress

I always consider a good choice to use WordPress at the CMS or studio sites. Because WordPress is very simple, it can realize the effects we want. We have been so familiar with WordPress – very friendly to users and search engines. These characters are incarnated into my recent product ‘Ovisualize‘. I would discuss some key points on implementing WordPress in this studio below. Wish to bring in some lights or suggestions when using WordPress to build the CMS sites.

Ovisualize index page

Ovisualize index page

The index pages of ordinary blog list the latest logs, whenas on studio sites it comes the introduction. Therefore we make it happen by adopting WordPress Page. For ‘how to’ details, please refer to this post: 5 simple steps to build CMS by using WordPress.

Index page of Ovisualize case

Index page of Ovisualize case

We generally use WordPress post to realize the pages with much renewal, such as studio cases or products. From above picture we know, the case requires a post thumbnail. We can make it by using custom fields. Read this document in details: Use custom fields to display post thumbnail.

Ovisualize case sample

Ovisualize case sample

The Sample page in Ovisualize displays a brief introduction to this product, and then there are a large case screencut and the list of similar cases. The large case screencut also applies custom fields. For the list of similar cases, I realized it by making some small changes on my pervious plug-in ‘WordPress Related Posts‘. I may add this function into future release.

Okay, that’s all for now. If anything unclear, please drop me message. If you have project related to this, also contact me(email/msn:denishua@hotmail.com). The quality is guaranteed, fair trade.

One WordPress installation, multiple blogs 1

09.19.2008 by Denis - 0 Comment
Posted in WordPress

For different database:

1. Point all domains to the same WordPress root directory.

2. Add the following code at beginning of wp-config.php:

$hostname = $_SERVER['HTTP_HOST'];
 
switch ($hostname) {
case "fairyfish.com":
    $db = "db1";
    break;
case "denis.fairyfish.com":
    $db = "db2";
    break;
}
 
// ** MySQL settings ** //
define('DB_NAME', $db);    // The name of the database

WordPress as a Group Twitter

08.29.2008 by Denis - 0 Comment
Posted in WordPress

XMPPHP is the successor to Class.Jabber.PHP. I use the class to setup a Gtalk bot and integrat it with WordPress, which turns WordPress into a group twitter.

  1. Change your WordPress’s setting: Anyone can register and New User Default Role is Author. These settings can be tweaked in Setting => Genenal of WordPress admin panel.
  2. Download the Prologue WordPress theme and install it.
  3. Download the Gtalk bot code file: xmpphp.zip
  4. Modify the wp-xmpphp.php file. Change the $gtalk_account and $gtalk_password according to your Gtalk bot account and password.
  5. Upload them to WordPress root directory. Make sure the wp-xmpphp.php and wp-config.php are placed in the same directory.
  6. Visit http://your-blog/wp-xampphp.php in your browser once to start the bot
  7. Use the cron job to run the following job: wget http://your-blog/wp-xampphp.php every 10 minutes.

During the test, this php GTalk bot occupied a lot of server resource.

Speed up WordPress plugin by using postmeta

06.05.2008 by Denis - 0 Comment
Posted in WordPress

WordPress Related Posts, a plugin that I developed which has been downloaded more than 20,000 times, has an efficiency problem. I have got several times suspend in one of my blog which is hosted by bluehost because of exceeded cpu quota, and the root of the problem is SLOW SQL of the plugin.

It is true that the plugin uses a very inefficient SQL . Because the plugin finds related posts base on tag, so it needs to scan all post’s tags.By now I still haven’t got any good idea to imporve this SQL.The
second method to speed up this plugin is using cache.My method is a little different.Instead of using cache plugin, I use postmeta to cache.

As we all know that postmeta table is used to store other custom fields of post. We can store the related posts list and the save time to postmeat. Next time we only fetch related posts list from postmeat, and compare the current time and the last saved time. If it is in the allow cache time, then display. Otherwise it will fetch the related post by the slow SQL, store it to postmeta and display it.

<?php
  global $id;
 
  $output_old = get_post_meta($id, "related_posts", $single = true); // fetch related post from postmeta 
 
  if($output_old){  //if not null
    $time = time();
    if(($time - $output_old["time"])<600){  //and in allow time (600 seconds) 
      echo $output_old["related_posts"];
    }
  }else{
    $output = wp_get_related_posts() ; //fetch related post from SLOW SQL
    
    $output_new = array("time"=>time(),"related_posts"=>$output);
    
    if($output_old){//if postmeta have the record, update it 
      update_post_meta($id, 'related_posts', $output_new);
    }else{ //no, insert it
      add_post_meta($id, 'related_posts', $output_new, true);
    }
    echo $output;
  }
?>

Of course there will be a problem via this cache. The setting from configuration panel will take some time to act it.

The new version WordPress Related post: WordPress Related Posts 0.8. :-)