Hints/Tips

Get Category Slug of The Post in WordPress

wordpress code 

I wanted to get the category slug for the current post but calls like single_cat_title() were not usable:

  • Return null unless you are on a category page
  • Can’t get to the slug string

If each of your post has only 1 category, this is the solution:

global $post;
$categories = get_the_category($post->ID);
$post_cat_slug = $categories[0]->slug;

Explanation by line:
/* get current post info */
/* get the category list for this post */
/* get slug for the 1st category */

To get a cleaner code, I put it in my functions.php and called from my template file.

Customized Global Variables for WordPress

customized global variable, wordpress 

Wanted to have one place for certain set of value in my WP site, after many failures, found this to be the easiest way.

In functions.php, define and initialize a variable:

$GLOBALS['your_var'] = 42;

To access the variable in a template file (between php tags):

echo $GLOBALS['your_var']

Import RSS Feed to A Facebook Page, The End

import rss, facebook page 

Still looking to import your blog feed into a Facebook Page? You can stop looking. It’s no longer available. Here is their answer:

We want you to connect with your fans in the most effective ways possible. That’s why as of September 30th (2011) you’ll no longer be able to automatically import posts from your website to your Page notes. The best way to get people to interact with your content is to give them insight into the links you share on your Wall by adding personal comments and responding to feedback from fans.

We’re focused on creating even better tools for Pages. Look for announcements soon.

So, I guess it’s back to manually posting links on your Wall.

Import RSS Feed to A Facebook Page, Part 3

import rss, facebook page 

UPDATE: FB Page no longer lets people import RSS feed. Please read “Import RSS Feed to A Facebook Page, The End” for their answer.

A visitor left a comment for Import RSS Feed to A Facebook Page, Part 2 (posted in 6/2009). It has been so long, I forgot to update on this topic.

Since using 3rd party apps often ask to share my info with more people, I now only uses FB apps. This is what I use now for importing RSS feed to my FB page.

Before I go on with the steps, I’ve found that FB doesn’t always update the feed on time (or even at all). But it’s free and it doesn’t matter to me that much so this solution might not work as well for your business.

Importing your RSS feed into “Notes” on your FB page:

  1. Login to FB and get to your FB page
  2. Click on the “Edit Page” gray button on the right, below the FB menu bar
  3. Click on “Apps” link in the left sidebar
  4. Under “Notes”, click on “Go to App”
  5. Click on “Edit import settings” in the left sidebar
  6. Copy and paste your feed into the box (I had problem using the “feed://…” option, so I used the “http://…./?feed=rss2” from my WordPress blog.) You may have to try a few things before it takes.
  7. Click on “Start Importing” button

Increase WP Upload Limit

wordpress, lunarpages 

A new client requested for a site where he will be uploading large number of photos and video but still want to use WordPress as the base of his site. But I’ve always seen the 2MB limit in the WP’s Media upload page and that will not work even with a short video.

I’m not sure how other hosts deal with this, but Lunarpages made it relatively easy.

It turned out to be a pretty easy fix:

1. In the root of your WP directory, find or create a php.ini file, then add this two lines: (? is the new limits you want to set)

upload_max_filesize = ?M
post_max_size = ?M

2. In your home directory (above your public web directories), find the .htaccess file, point the directory to where your php.ini file is in step 1:

suPHP_ConfigPath /home/yourUserName/public_html/yourWP_root

(remember to replace yourUserName and yourWP_root [might be blank if you installed it as the root])

Notes:

  • If you’re not hosted by Lunarpages, you should check with your own host for a solution.
  • Make sure you only use text editor to change the 2 files I mentioned here. For Mac: BBEdit/TextEdit. For PC: Notepad
  • Always save a copy before you change these files
  • If you don’t know how to see hidden file on your computer (like .htaccess), go here for Mac: via Terminal; via Finder Window, here for PC

Beware of Phantom Vendors

consumer protection 

Few weeks back, while I was visiting a local eatery, the owners told me they were meeting with a web design company so they can finally have a web site again. The last guy they hired took their money then disappeared.

Today, the owners told me that they where happy with the price that company quoted them but still ask them for a few days to think it over. That the company turned out to be a phantom vendor. They couldn’t get them on the phone and the address was fake. Good thing they didn’t get scammed again.

So, for all the business owners out there, before you hire anyone, check out if they are register to do business in your states. In Washington state, you can go to the Department of Licensing site to search for business licenses.

And as other situation in life, trust your instinct. I think that’s what saved my friend this time.

New Entrepreneurs Beware

scam, internet, domain name registration, whois 

After many months of watching and waiting, I had secured a .com domain name for my client at last. But it wasn’t easy to keep the scammers away from my client’s credit card.

My client had purchased all the other related extensions (.biz, .net, etc.) because the .com for this domain name wasn’t available. A few days before the .com went back to the public pool, my client got an email that they are SELLING the .com name. Mind you, at that time, NO ONE had the authority to the domain name.

They wanted $100 for 1 year of ownership. We got it for $10 and there was no question who really owned it since I registered it myself. The funniest thing is even after we got the domain name, the same type of emails were still coming to my client.

So to all the enthusiastic new business owners out there, never trust emails or snail mails that found you, always research before you act.

To check to see if the domain name of your desire is available to buy, use the WhoIs service from InterNIC (a public site):

http://www.internic.net/whois.html

If it’s ready for you to register, you’ll see “Domain names in the .com and .net domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information.”

Being aware of this scam will not only protect yourself, you can take away the incentive for the scammers to keep scamming.

Twitter Basics 2

twitter, how-to 

If you need to start from the top, see Twitter Basics 1.

As always, log in to twitter first.

Q. How to I know if someone is talking to me on twitter? Is it like e-mailing?

No, it’s not like e-mailing. When you tweet a message, it’s like posting a message on your public bulletin board. People who wants to see your messages on your bulletin board will need to follow you, so when they log in they can see your recent tweets.

Many people use software to track conversations on twitter but for beginners, I think we will just use the simple free tools.

Method 1: (I think it’s easier to see what’s going on)

  1. Go to http://search.twitter.com/
  2. Put in “@your twitter id” as the search word. My id is “IonDesign” so my search word is “@IonDesign”.
  3. The results is a list of tweets from other people that mentioned your twitter id.

Example: _moneywhisperer: @IonDesign I found you!!

In this tweet, _moneywhispere wrote “I found you!!” to me. And if you see two icons on the left, that means the person is responding to your tweet.

If you see “RT” in the message that means “ReTweet”, someone is just repeating your message, not necessarily writing to you.

RT Example:

First I wrote a message to Home Depot:
The staff at Issaquah @HomeDepot garden center are helpful (took a 50lb bag to my car with a bright smile), friendly and fast! Thank you!

Home Depot ReTweeted my message instead of replying:
homedepot: RT @IonDesign staff at Issaquah @HomeDepot garden are helpful (took a 50lb bag to my car w/a smile), friendly and fast! Thank you! //thx!

Method 2: (not as easy to see what’s going on)

  1. Click on “Home” in the top right corner of your twitter window
  2. Find and click on @your twitter id (mine looks like @IonDesign)
  3. You will get a list of any tweets that included your id

Q. How do I respond to the tweet?

When you find a tweet you like to respond to, just click on the “Reply” link. Twitter will start it up with the twitter id of the person you are responding to, so just fill in the rest.