May 25

This is a guest post from Margaret Saunders who is a web hosting consultant for IXwebhosting, a web hosting company based in Ohio.

Of all of the content management systems available for free on the Internet, WordPress has consistently been shown to be one of the best over and over again. While WordPress has thousands of themes and plugins that can be used to customize a website and provide additional functionality, sometimes webmasters will want to do something that there isn’t a plugin for, or they will want to do it by themselves without having to add a plugin. In these instances, they have to turn to WordPress hacks. What follows is a list of some of the most popular and most important WordPress hacks.

WordPress Hack #1: List recent comments.
There are a few plugins that allow webmasters to display the most recent comments posted on their WordPress sites, but these plugins are usually confined to the sidebar. With a WordPress hack to list the recent comments on a site, the recent comments can be shown anywhere on the page, including inside of a post. Add the following code to your functions.php file.

<?php
function recent_comments($src_count=10, $src_length=60, $pre_HTML='<ul>', $post_HTML='') {
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,
SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC
LIMIT $src_count";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
foreach ($comments as $comment) {
$output .= "<li><a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"on " . $comment->post_title . "\">" . strip_tags($comment->com_excerpt) ."...</a></li>";
}
$output .= $post_HTML;
echo $output;
}
?>

Whenever you want to add the recent comments, just add this code:

<?php recent_comments(); ?>

WordPress Hack #2: Pull the first picture from posts.
WordPress’s home page, the search pages, and the archive pages are all capable of displaying only a small portion of a number of posts in a list. While there is no built-in option for these lists to automatically display the first image from each post, it can be easily done with a WordPress hack, and it looks great. To implement this hack you need to edit your functions.php file in your theme and implement this code:

function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img .+src=[\'"]([^\'"]+)[\'"].*/>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];

if(empty($first_img)){
$first_img = "/images/default.jpg";
}
return $first_img;
}

In case you have a post that does not have an image, don’t forget to implement a default image on line 10. Now, you can simply call the function within the loop to display the first image from the post.

<?php echo catch_that_image() ?>

WordPress Hack #3: A print button on posts and pages.
Lots of plugins are available that give someone the ability to easily print the content from WordPress posts and pages. However, a lot of these plugins subject the readers to advertisements. Instead of imposing this on the readers, it can be a better option to use a WordPress hack to create a print button that will take the reader directly to the print dialog window. To do this open your single.php file (for individual posts) from the theme folder and add the following code:

<a href="javascript:window.print()" rel="nofollow">Print this Page</a>

WordPress Hack #4: Automatically include the author’s information with each post and page.
On article directory sites, there is often a resource box at the bottom of each article that gives a brief description of the author of the article. Along similar lines, it’s possible to make a box of information about the author appear with every post or page on a WordPress site using WordPress hacks. For this you’ll need your Style sheet and add this to it:

.postauthor {
}

Then you’ll need to go through your index.php file within your theme and look for a similar code like this:

<?php the_content('Read the rest of this entry »'); ?>

Above this code you implement the following:

<div>
<?php the_author_description(); ? >
</div>

All that is left to do now is to add your own style to format the about author box.

WordPress Hack #5: Buttons to send posts to Facebook or Twitter.
The two most popular social networking sites are Facebook and Twitter. Because of their popularity, it’s very important that a website is integrated with both platforms. With a WordPress hack, buttons can be added to send a post or page from WordPress directly to Facebook or Twitter without having to configure some annoying plugin. For the Facebook button add this to the loop in your single.php file in your theme.

<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>" target="blank">Share on Facebook</a>

For twitter add this to your loop:

<a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Click to send this page to Twitter!" target="_blank">Share on Twitter</a>

In Conclusion
Just because there is a plugin for a feature in WordPress, that doesn’t mean that, it’s good enough to make people want to use it. Many people enjoy doing things themselves so that they have full control over what is added to their websites. These people often prefer WordPress hacks over WordPress plugins because of the sense of doing it themselves and accomplishing something important. The six plugins listed here are good examples of people taking matters into their own hands when it comes to their WordPress websites.

For further questions and suggestions don’t hesitate to contact me.

Margaret Saunders
margaret.saunders@ixwebhosting.com

\\ tags: , , , , ,

Nov 17

Open Source Today, I was thinking to develop two WordPress sites for the upcoming projects of mine.  While searching for the good themes, I recalled that Revolution themes have become open source.  So went to http://www.revolutiontheme.com/ and it redirected me the http://www.revolutiontwo.com/. Site was looking nice.  I browsed through the site, but unable to see any download link.  What I was seeing was $99.95/year Pro Package and $149.95/lifetime Pro Plus Package.  I thought that being open source these themes will become free for download.  Clicked the support link to see if there is a link, in vain.  It was telling me that I should sign up to see the threads.  Surprised!  Should I need to signup to get these themes? Confused!  It is approx 100 dollars, which I can’t afford.

So, opened Google and asked “Big G” to show the way to “revolution wordpress themes download” and landed on http://www.wphacks.com at this post http://wphacks.com/revolution-wordpress-themes-2/ The post was showing Revolution themes with links to download.  When I clicked on the link it has gone to e-junkie and returned to the homepage of RevolutionTwo.com.  It was frustrating.  So I had to go through all the comments of wphacks’ post to see if anyone is having the same problem and stuck at a comment where a guy was having the same problem.  What he was seeing was just the signup links like me.  Kyle Eslick commented that he should see a download link in small text.

Kyle Eslick's comment at WPHacks

Then I returned to the site and now I can clearly see the download link, which is in very small font and was looking like a footer note.  So, it took half an hour for me to find the download link.

Theme download link, which will be ignored as footer link

Theme download link, which will be ignored as footer link

After downloading the theme, I opened the zip file and found no instructions on setting up the theme.  Again I went to support site and was able to get a little details on setting up the themes, one or two threads, which are open to anyone.

So, what I want to say is:

  • Though it says Open Source, I don’t see the things like what I see on many open source sites.  Site is misleading the visitors making them to sing up for the 100 or 140 dollars membership, looks like playing a cheap trick to get signups.
  • Why don’t you people put the download links more prominent rather than making it look like footer links?
  • Why there is no setup guide in the themes?

Read the below comment by DerFrankie at WPHacks, that is what came into my mind after half an hour search.

I think, that the way Revolution is doing this is quite the oposite of open source.

You might think that a normal open source project will focus on developing a product (theme), documentate it, and release it as a base for contribution and a community to build upon it.

To monetize the effort of the releasing firm, some firms offer service and support agreements (btw a new forrester research has shown that most open source projects relying solely on support contracts don’t pay off).

I cannot see this with this themes. The site states that is open source – but it’s main goal is to sell the service.

On the site you have to “search” for the download link. There is no “project” behind it and the customization has to be done, by “hacking” into the theme, making it difficult to upgrade.

And, many more questions, but when somebody is offering things for free, we can’t question them.  Anyway, if you want to download a theme and use it for your blog, below links will be helpful:

  • Download links are at the bottom in small font as you can see in the image above.
  • Theme tutorials are here: http://www.revolutiontwo.com/support/viewforum.php?f=14 though they do not cover all the things.
  • Go to Justin Tadlock’s http://themehybrid.com/ and you can find few free themes similar to Revolution. Read the documentation and experiment with those themes.
  • Play with Darren Hoyt’s Mimbo theme to understand setting the categories and custom fields.
  • Now, go to Dashboard>Theme Editor and edit the theme files to setup the themes correctly.
\\ tags: , , ,

Aug 25

Today, I had to update one of my customer’s WordPress blog from 2.5 to the latest version, 2.6.1. As it was hosted on a free hosting server, I had to manually upgrade. It was also first time for me to upgrade a WordPress installation manually because my hosting provider, DreamHost, offers a one click upgrade without needing any manual intervention.

So, I have downloaded the new version onto my desktop and read and understood WordPress’ Guide to Upgrading WordPress thoroughly. Then, logged into the free hosting provider’s control panel and started taking data and files backup. I thought the process of upgrading will be going to take at least one hour. When WordPress can do auto upgrade of plugins, why not the core installation, like SMF?  Then, started searching in Google whether anybody has made any attempts towards it. Luckily, I found one nice plugin that can auto-upgrade the WordPress installation, WordPress Automatic Upgrade by Techie Buzz. Just installed this plugin and with few clicks I was able to upgrade the installation to 2.6.1 in less than a minute. Thanks Keith.

Don’t forget to download the files and data backup it provides while attempting to upgrade. If it fails to upgrade for any reason, you can manually do it, but I am sure, it never fails :)

Mar 11

Today, I am going to share my favorite “bookmarked” WordPress themes that look like CMS/Magazine. I wanted to make a post with all my favorite themes and came with this post.

My favorite theme maker is Justin. He has more number of magazine-style themes to his credit than any other theme maker and I often visit his blog to see if he has released any new. He is so kind and releases premium WordPress themes for free.

If somebody asks me to select the top one from my list, I would select Mimbo by Darren. He also has a list of good tutorials to customize the WordPress.

1. Mimbo by Darren Hoyt | Demo | Theme Info & Download

Mimbo

2. Options by Justin Tadlock | Demo | Theme Info & Download

Options

Continue reading »

Apr 01

greendog.jpg I liked the WordPress theme GreenDog by Alexander, but it was in Russian language. I have also seen that few more also looking at the English version of that theme. As an experiment, I have tried to translate it. I took the help of Google Translate. Google translated all the words correctly except one or two.

Hey…do you think that I know the Russian language. No, looking at the English theme, I have done it. If you like it and use it, please post it in the comments with your site address.

download.gif Download the theme