Posts Tagged wordpress

Wordpress blog development tip

When I started this personal blog, it was a matter of a few clicks in a tool called fantastico and everything was up and running. Whatever development and style modifications I have done over the time were directly on the server. As a matter of fact, I still do.

Clearly, it is not the best idea for incremental development, not without inevitable “production downtime”. Working in a big internet company at least taught me this truth among other things. So, when I started my photoblog using pixelpost, I set everything up in my local MAMP stack and pushed the data to server one time.

joy@localhost ~ $ mysqldump -u user -ppass db > db.sql
joy@localhost ~ $ scp -C db.sql joy@server:
joy@server ~ $ mysql -u user -ppass db < db.sql

Afterwards all code pushes happen by rsync.

joy@localhost photoblog $ rsync -avz . joy@server:public_html/photoblog

This way, even though locally I have a small set of data, I can change code and test all features before doing a production push. Works very well for me. Also I check in my code in a local git repository. Double win.

I am in the middle of setting up another wordpress blog right now, and forgetting a small detail cost me a bunch of time. After getting the blog running locally, I took a mysql dump and synced it with the db in the server. It just won’t load. I mucked around here and there and figured that the blog url is set as “http://localhost:8888/newblog” in the local db. I modified the .sql file and re-synced to production and voila, it worked.

I suspect that I might need to do the db sync a few more times before I have enough volume of data to keep it growing in the server. I will probably set up a sed script to do the search-and-replace in command line.

, ,

No Comments

Wordpress fusion theme: twitter widget link problem

The twitter sidebar widget in the fusion theme of wordpress shows weird in Firefox browser, due to the encoding of the double quotes in the href attribute. For example, a link from a twitter post shows like this in source:

  1. <a href=&quot;http://bit.ly/foo123&quot;>bar</a>

Safari in quite intelligent regarding this and displays the links right.

A look in the code revealed that the output from twitter webservice call is not completely decoded. The function fusion_TwitterWidget() in wp-content/themes/fusion/functions.php looks like this after an easy fix:

  1. // theme widget: Twitter
  2. function fusion_TwitterWidget($args){
  3.  extract($args);
  4.  echo $before_widget;
  5.  print $before_title.__(‘Twitter posts’,'fusion’).$after_title; ?>
  6.  
  7.  <?php
  8.  $username = get_option(‘fusion_twitterid’);
  9.  $limit = get_option(‘fusion_twitterentries’);
  10.  if($username<>) {
  11.   $feed = file_get_contents("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit);
  12.  
  13.   // joyd: fix for the broken hyperlinks of twitter plugin due to encoded quotes
  14.   // $feed = str_replace("&lt;", "< ", $feed);
  15.   // $feed = str_replace("&gt;", ">", $feed);
  16.   $feed = html_entity_decode($feed);
  17.  
  18.   $clean = explode("<content type=\"html\">", $feed);
  19.   $amount = count($clean) - 1;
  20.   print ‘<ul id="twitterupdates">’;
  21.   for ($i = 1; $i < = $amount; $i++) {
  22.    $cleaner = explode("</content>", $clean[$i]);
  23.    print ‘<li class="entry">’;
  24.    echo $cleaner[0];
  25.    print ‘</li>’;
  26.   }
  27.   print ‘</ul>’;
  28.  }
  29.  
  30.  echo $after_widget;
  31. }

Thanks a lot to Francesco to point this out !

,

4 Comments

Wordpress default wide theme

Two years back when I started my blog, the wordpress default kubrick theme was the cleanest. It still rocks to this day, but wider monitors have become so affordable and commonplace that the default theme seemed too narrow. I couldn’t even post a photo more than 450px wide.

I thought about tweaking the css and images and then found it has already been done at cenolan.com: http://www.cenolan.com/2008/11/wordpress-default-theme-1024-wide/

Works perfectly as is. Highly recommended.

,

No Comments