TutorialsStay up to date with the latest news & announcements from Gabfire Themes

How to Create a WordPress Child Theme

We’ve all been there: the crossroads of updating your theme and overwriting the edits you made to it. Either you have

image courtesy of wpsmackdown.com/

image courtesy of wpsmackdown.com

to leave your theme out of date or erase all the work you put into customizing it. Maybe you’re lucky and the changelog specifies which files are new so you can update manually, but this can be meticulous and time wasting. There must be an easier way!

Why Child Themes are Useful

Child themes are the root of customization. They allow you to customize your themes, while keeping the main theme intact so updating won’t erase your changes. Basically, a child theme is a ‘new’ theme that simply loads the framework from the parent theme. This way, whenever you update the parent theme, the child theme is ‘updated’ too. Neat!

Note: For minor CSS changes, use the Custom CSS box located in your Theme Options; for any PHP customization, use a Child Theme. Continue reading »

How to Create a Twitter API Key

In order to use the Twitter API Key to pull tweets and other information from your Twitter profile or other sources in the Twittersphere, you’ll need to create a Twitter Application through your account. It may seem super-technical, but it’s actually very simple to do.

twitter-logo

How to Create a Twitter Application

The first thing you need to do to get your Twitter API key is to create a Twitter application through their site. Visit dev.twitter.com/apps and login to your Twitter account. Then, just fill out the basic information for the application and it’s ready to be published. Continue reading »

How to Redirect WordPress RSS Feed to Feedburner without a Plugin

FeedBurner is a Google owned service that provides RSS traffic analysis and an optional advertising system to online writers. The extra features that FeedBurner offers make it very attractive to WordPress users and many bloggers use the service to power their site feed so that their visitors can subscribe easily.
wordpress-feedburner

How to Redirect WordPress RSS Feed

There are a few plugins and .htaccess methods to redirect the default WordPress feed URL to Feedburner, but if you’re looking  for a way to redirect your feed with a simple WordPress function, copy the code below and paste it into the functions.php file of your theme.

$username = 'gabfire';

function rss_feed_redirect() {
global $feed;
$new_feed = 'http://feeds.feedburner.com/$username';

if (!is_feed()) {
return;
}
if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])){
return;
}

if ($feed != 'comments-rss2') {
if (function_exists('status_header')) status_header( 302 );
header("Location:" . $new_feed);
header("HTTP/1.1 302 Temporary Redirect");
exit();
}
}
add_action('template_redirect', 'rss_feed_redirect');

Make sure to replace gabfire on line #1 with your FeedBurner username and you’ll be all set to redirect your default WordPress feed URL to FeedBurner!

WordPress Optimization Tips

I was particularly interested in attending the WordPress Optimization session presented by Ben Metcalfe of WP Engine during WordCamp Philly. Considering that most of our end-users are on shared hosting and not well-versed on technical jargon, it’s common to receive questions on the support forums related to slow sites / servers / and optimization tips.

Ben provided a list of to-dos for WordPress optimization. Some are a bit technical and you may need a server admin to perform them, however others are do-able right from within WordPress. If I find a link to Ben’s presentation online, I’ll be sure to link directly to it. For now, here’s the quick list to consider depending on your setup and circumstances:

For all users:

  • Keep WP Updated – Always stay updated.
  • Use a Cache Plugin – WP Super Cache or W3 Total Cache work for most users. Even WordPress.com uses a cache plugin.
  • Deactivate Unused Plugins – If you have plugins you are not using, deactivate them. If you’re sure you do not need them, delete the plugins. Note that in some cases, even if a plugin is deactivated, it may still be loaded into memory. In short, be a neat-freak about your plugins.
  • Avoid Bad Plugins – I provide a list of some of these on the support forums.
  • Review Your Theme – roughly 1/3 of all optimization problems are due to theme code. Ensure it validates. When possible, place CSS at top and Javascript at bottom (not inline). If you see any weird code (i.e., making requests to other sites on the internet) then abandon that theme.
  • Hosting – Check your hosting solution. Who is on your server? Use YouGetSignal’s Reverse IP Lookup if you wish to see other sites on your site. If you have non-kosher sites on the same server, ask your host to move you to another one. If you have a thousand other sites on your server, you have quite a packed server (or said differently, a terrible host).
  • Offloading (poor-man’s CDN) – If you have the ability to offload your images or other large files (videos, etc.), do it. Flickr is a great solution for serving images.
  • Feedburn your RSS Feed – Let Google’s FeedBurner handle your feed. Check your logs to see how many requests are made to your /feed url.
  • Repair your MySQL Database – Be consistent in repairing your MySQL database. Once a month is fine for most users.
    • OptimizeDB plugin by Joost does this for you without any overhead
    • Use PHPMyAdmin – only if you are tech and db-savvy
    • Manually – only if you are tech and db-savvy
  • Load from Multiple Sub-domains – To bypass limits on simultaneous processing, if you understand domain mapping and server administration, then look into using multiple sub-domains for serving files. Even better, try using different domains.

    good:

    foo1.yourdomain.com, foo2.yourdomain.com

    better:

    foo1.otherdomain.com, foo2.otherdomain2.com

  • Browser CachingW3 Total Cache will take care of this – HTTP cache-control, expires header, and entitry tags.

For Advanced Users and High Traffic Sites:

  • Log Slow MySQL Queries – check your logs! What’s taking the most time? Dig into it.
  • Good How To:
    Check Site with Profile Tools- use any of the tools below to dig into your site’s performance.
  • CDN – Use a CDN. It can be used all the time – OR – just in “emergencies.”
    • MaxCDN (used by WP Engine)
    • Amazon CloudFront
    • CloudFlare
  • Smush Images – Let’s face it – you don’t sit there and optimize every image before uploading it to your site. The plugin below will do it for you.
  • APC / Opcode cache – PHP-APC + W3-Total-Cache
  • Apache Optimization – your server admin should be able to optimize your Apache server. When possible, disable .htaccess and use httpd.conf instead (central library that Apache uses). Do NOT attempt this unless you know what you are doing! It is not for beginners.
  • Dedicated MySQLDB Box – Consider moving your MySQLDB Box to another server in the same data center.
  • Reverse-proxy with nginx – Run Apache on port 8080. Cache static pages.
  • Varnish Cache – Ideally, do not run Varnish on port 80 (even though some tutorials tell you to do so on port 80). Varnish cache doesn’t like cookies. Send cookies to nginx.
    • Update (Jake’s Comment)
      Varnish VCL should be configured to destroy cookies when unnecessary (not logged) and to destroy cookie of static content.

      http://blog.brigato.fr/2011/12/24/wordpress-performance-guide-from-5-to-6100-requestssec-on-a-1vcpu1gb-ram-vps/

  • Memcache – Ideally, run Memcache on a separate box in the same datacenter under the same subnet.
  • HyperDB – multiple database servers – not intended for the standard user.
  • Static Site on Amazon S3 – If you can generate your site as static pages, Amazon can host them. Do not do this if your site requires any dynamic widgets or data processing.

Finally, here’s something that should be reinforced by everyone, do not edit WordPress core files. It’s not good practice and will be overwritten when you upgrade your WP installation.

Now, go optimize your site!

How To Buy a Domain Name


If you’re reading this then you want to know how to buy a domain name. Acquiring a great domain name is the first step in building a web site. It’s also one of the easiest things to do online – even for beginners with no technical knowledge.

Considerations

  • Do Keyword Research. If you plan on building a web site related to horse riding, then you’ll want to research the keywords in Google and check out your competition. Based on your research, determine what keywords you plan on targeting for search results and choose the domain name that best reflects your topic. Tip: It’s a good idea to have your keyword in your domain name for ranking purposes. This is not absolutely necessary, but definitely helps.
  • Choose the proper top-level domain or TLD. In other words, the suffix of your domain (i.e., .com, .net, .org, .info, etc). If your business is in the United States, then you should use .com as your domain. Most users assume domains end with a .com, so that should be your first preference. If .com is not available, only then would I recommend .net. The .org TLD is reserved for nonprofits. Stick to these TLDs and avoid the rest.
  • Check the domain name history. Google for previously indexed pages or any negative backlinks. You want to start with a clean slate.

Continue reading »

Sample HTML Code for List

Here is a sample HTML code to generate a proper list:

<pre>

<ul>
<li>Naming a Business or Product</li>
<li>Distribution of Print Media</li>
<li>Logo and Identity Design</li>
<li>Advertising campaign setup</li>
<li>Search Engine Optimization</li>
<li>ApplicationDevelopment</li>
</ul>

</pre>

How to check Category and Page ID’s

One of the major change of WordPress 2.5 was to remove the IDs on all admin pages. The reason of removing ID’s from admin pages was probably due to the fact that the common user don’t need them but since our templates are magazine/news style where we do have multiple loops on main pages, we will need to check category ID’s in order to set our templates.

If your browser shows the URL in the status bar, you can see the ID number when you mouse over the category link. If the status bar is disabled, you can activate it by checking the Status bar choice under View on both Firefox and Internet Explorer. Continue reading »

LATEST THEMES