How to Set Featured Image in WordPress 3.5 or Later

Setting the featured image changed just a bit with the upgrade to 3.5 and later. I’ve gotten several questions about how to set the featured image in WordPress 3.5 so I’m sharing for all in 3 Easy Steps.

1. Edit Your Post

Edit your post and on the bottom right there should be a link to “Set Featured Image”. (see below).

Think2Loud-set-featured-image-1

 

2. Choose Your Image

Usually, the featured image you want to use will already have been uploaded to the page. So select “Uploaded to this Post”. If no images are uploaded yet, you can use the next screen to upload as well.

Think2Loud-set-featured-image-4

 

Once You have found your image or uploaded it. Select it with a click and then click “Set Featured Image”. (see below).

 

Think2Loud-set-featured-image-3

 

3. Save Your Changes

Don’t forget to click update when you are back on the edit post page to save your changes.

That’s’ it!

Tranformers of Themes

It just so happens that here at Think2Loud we love WordPress. We’re hoping that some of you do too and we want to share some of the exciting things we’ve learned or used that WordPress users (both novice and advanced) will find useful and informative. But we’re sure we don’t have all the answers, so if you think we’ve missed something please let us know in the comments. We’ll do our best to respond quickly!

You may have noticed that we changed our theme not too long back. We are running the Together theme by ThemeBrewers.com and now that we’ve had time to play around with it here and on our other sites we wanted to start sharing some of the things we really like about it starting with its ability to transform itself into lots of different looks with just a few clicks…

Global Theme Layout

The ability to set a global layout was one of the first things that really sold us on using the ThemeBrewer themes. Anyone who has purchased a theme somewhere only to find out that it would take an act of God or the very least help from one of your nerdy…errr…technically gifted…friends to get it to do what you wanted it to do should appreciate the incredible simplicity of radio buttons to change their layout. And better yet, you can wait to call in that favor from your own personal tech support until you really need it.

 

Per Page Layout

But what happens when you have some content that just can’t follow your global layout? Perhaps you have some graphics or other content that just doesn’t fit with the sidebar or maybe you need an extra sidebar for a particular page. That’s no problem either because each page can specify its own layout independent of the global option. Pretty cool stuff! And of course what makes us happiest about this whole process is we didn’t have to dig around in the theme code to make these changes.  And hey, it’s not like we’re lazy or we couldn’t write some code if we had to, but our TiVo might fill up and not record something important!  There are just some risks not worth taking.

We hope to delve into more of the cool features we like about ThemeBrewers themes over the next few weeks and we may even start tinkering with some of their other themes just to help us get familiar with, and test out, all the features. Besides, it’s always fun to redesign your blog, right?  Especially if it can be done quickly.

Let us know what you think in the comments and maybe even consider signing up for our newsletter.  We will be testing out a new WordPress newsletter application in the next few months, but we promise not to spam you. Optimus Prime would never allow it!

Espresso Theme Framework and ThemeBrewers

Introducing ThemeBrewers and easy-to-use Espresso Framework that launched yesterday. ThemeBrewers is a new place to get premium and free WordPress themes all built on their new theme framework Espresso.

Introducing ThemeBrewers and the easy-to-use Espresso Framework that launched yesterday. ThemeBrewers is a new place to get premium and free WordPress themes all built on their new theme framework Espresso. Custom built easy to use option are the foundation of the Espresso framework. Espresso is a parent theme and uses template parts to allow for easy customization of your child theme.

Espresso Features

  • Multiple Layout Options for Header, Content and Footer Areas
  • Easy-to-Use UI for Theme Customizations
  • Unlimited Sites
  • Unlimited Updates via Automated Updates
  • Optimized for WordPress 3.1+
  • SEO Optimized and Developed to Work with WordPress SEO Plugin by Yoast
  • Custom Image Sizes with Image Regeneration Support
  • Custom CSS and Styling Options
  • 7 Widgetized Areas (one in the header, two in the sidebar, four in the footer)
  • Multiple Shortcodes and more

Win a free Pro Membership

With the grand opening of Themebrewers they are giving away a free pro membership. All you have to do is go to the following link and enter to win.
ThemeBrewers Give Away

Organize your WordPress Theme in 3 Easy Steps

Like many developers out there, I do my best to write clean and manageable code. Read on to find out three simple steps to make your WordPress themes better than ever.

I make an effort to keep my code clean for two reasons, ease of use and maintainability. It’s far easier to fix bugs or make updates to the code if it’s clean. It will take much more time if six months or a year from now you need to re-examine your code to figure it out, rather than just fixing the issue. I also am a firm believer in the saying “if you’re going to do it, do it right the first time.” and by proxy “make it right”. Every developer sees some “bad code” at some point, sometimes they may have even written it. I feel it’s important to correct wrongs as you see them and improve your own code as you go.

That’s no easy task, but WordPress makes it a little easier when it comes to theme development. Here’s three steps you can take to make your themes a little better than before.

Step One: Proper Template Directories

This is more of a general step you can take, but still useful, and it’s as simple as creating folders to organize your files in. Many developers like to have seperate folders for JavaScript, CSS, and images. These are the folders that I use to keep everything in its place:

  • /theme-directory/css/
  • /theme-directory/images/
  • /theme-directory/js/
  • /theme-directory/includes/

That last one is important. Anything custom that i’m building for the theme, such as a meta box or option page for the admin section of WordPress, would live in this folder. I used to put some front end PHP in there as well, but more on that later.

Step 2: Registering your CSS and JavaScript

WordPress comes with several functions you can use to queue and load your CSS and JavaScript files. You can set a version number for the files, and even tell WordPress that a specific file requires a previously queued file before this one loads (for example, requiring that jQuery is loaded before a jQuery plugin your theme needs gets loaded).

Step 3: Use WordPress Template Files!

WordPress is built around themes and plugins, and it’s really easy to make your theme easy to manage if you use what has been given to you. The best example of this is the function get_template_part(). This function allows for you to split your template files into smaller more manageable blocks of code. For example, you can make a loop.php file that you can use in all of your template files and include it simply by calling get_template_part(“loop”). It’s just that easy! You can use this function to display any file you make in the main template directory, the possibilities are endless.

That’s all there is to it. Check out the following links for more information.

wp_register_script
wp_deregister_script
wp_enqueue_script
wp_register_style
wp_enqueue_style
get_template_part

Awesome WordPress Feature of the Day: Add Theme Support

This has become one of my favorite features when I build a new WordPress theme. It seems like such a simple thing, but when I started coding my themes with this function in mind everything melds together so nicely.

My favorite new function in WordPress is Add Theme Support.

As a developer, one of my favorite things to do is write reusable code. I love when I start a theme and find it needs some bit of functionality that I wrote for something else, if all i need to do is include a file and make a couple strategic edit my job just got easier. Here is a quick example. Imagine you have a custom post type for events ( just an example, I have no code to back this up, sucks I know). If you create your event post type in a class, you can use the current_theme_supports method to check and see if you need it, and your class does the rest!

if(current_theme_supports('event-post-type')){
add_action("init", "jmh_event_post_init");
}
function jmh_event_post_init() {
global $event_class;
$event_class = new event_post_class();
}

So if you build a lot of themes, set up a single folder with an init file. include all your files there, organize it, then your functions PHP will just need to start off with a couple things:

add_theme_support('event-post-type');
require_once('your init php file');

Enable Multi-Site in WordPress

WordPress merging with WordPress MU makes an awesome software package even better. The issue now is, how do you turn on the multi-site functionality? If you are like me and find yourself forgetting that one line of code needed to kick off the setup of multi-site within WordPress. Then you made it to the right place, because for your benefit and mine I have taken the time to write down the steps involved. The first step is to install WordPress so be sure to head over to WordPress.org for the latest version and then do a standard install of WordPress. Once you have WordPress up and running you can enable multi-site in just a few quick steps.

1. Add the following to the wp-config.php

/**   MULTI-SITE SETUP   */
define('WP_ALLOW_MULTISITE', true);

2. Navigate to Tools > Network and choose your install type

You will have to choose what kind of network you want to run. Your choices are either Sub-directory setup or a Sub-domain setup. These choices affect how the addresses of your sites look.

Sub-directory
This configuration means that all your blogs/sites created within WordPress are extensions of your domain. So if you were using the domain myawesomesite.com then your blogs/sites within WordPress would all have domains like:
myawesomesite.com/siteone
myawesomesite.com/sitetwo

Sub-domain
This configuration does require some extra DNS work meaning you will need to setup a wildcard DNS record. With this setup each new blog/site in WordPress becomes it’s own sub-domain of the top level domain that was used to install WordPress. So if you installed WordPress on the url myawesomesite.com each new site’s domain would look like:
siteone.myawesomesite.com
sitetwo.myawesomesite.com

Once you have chosen the setup you want to run enter your network details and hit install.

3. Finish up the network install

There are a few things that you need to do manually to finish the install.

Create the blogs.dir directory
Create a new directory in the wp-content folder called blogs.dir, this directory will be where all your sites uploaded content is stored.

Edit wp-config.php
WordPress will generate some new settings for you to add to your config file. These settings are specific to your network. For the myawesomesite.com setup they would like this:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'myawesomesite.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

Edit or create the .htaccess file
If you already have a .htaccess file setup then you will just want to edit the area the contains WordPress rules. If you don’t have a .htaccess file go ahead and create one. Now all you have to do is copy in the settings provided by WordPress, save the file and you are done. This is an example of the code generated by WordPress:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

4. Remove the Tools > Network menu option

Once you have your network setup you can remove the menu option simple by commenting out the enable multi-site option in your wp-config.php file.

/**   MULTI-SITE SETUP   */
//define('WP_ALLOW_MULTISITE', true);

First Impressions: Genesis Theme Framework

Lately I’ve been doing a lot more work with WordPress, and it’s given me the opportunity to work on lots of different themes and theme frameworks. Given the choice I would much rather start a new theme from scratch. Of course “from scratch” means using one of the many starter themes people have put together, recently my favorite being BLANK from the Digging into WordPress Theme Clubhouse. However when working in a production environment I’ve found it beneficial to find a framework and stick with it. That way projects get done faster, everyone uses the same codebase, and clients all get a similar experience.

Enter the Genesis Framework from StudioPress. As soon as I got a look at how the framework is built I was instantly impressed. First, it has several great features that are helpful to both developers and users. It offers automatic updates, great security, customizable theme settings, custom widgets, plenty of layout options, and the list goes on. There are a lot of frameworks out there that give you similar things, but Genesis has some really cool features for developers too.

For starters, the theme is fully compatible with all the new features in WordPress 3.0. StudioPress was quick to add those features for their users, and that kind of dedication to their product is a huge value. Another great value for developers is the themes construction. They have built Genesis to be a starting point for child themes, allowing for radically different sites without having to do the same edits to the main theme over and over again. To help make a child theme as customizable as it needs to be in order to be successful, they have built in plenty of hooks to do whatever you need. If you want to add a widgetized area above the footer, it’s easy. You need an add area above the content, it can be done. Anything you can think of you can do. Proof of this is easy enough to find, since from what I can tell every theme that StudioPress has available is a child theme of Genesis.

On top of all this, StudioPress has an active community of users and developers on their forums that can offer help to any problems people come up with. I think anyone who really uses WordPress knows how important an active community can be.

To wrap this up, I can simplify my first impressions into one word : awesome. I’m really looking forward to building some cool stuff on top of this theme framework, and when I do i’ll be back writing a post about it.

Displaying custom post types on your WordPress blog homepage

So you have created a great new custom post type in WordPress 3.0 but it doesn’t show on your homepage. To add your new post type to the homepage you could use the following code in your functions.php. As you can see this code sets all the post types you would like to have displayed by using the pre_get_posts filter. I think using the filter would be great but currently it breaks the new menu’s in WordPress 3.0.

add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {
	if ( is_home() )
		$query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );

	return $query;
}

So to add your custom post types into the your blog homepage you can put this code just before the WordPress post loop. The following code adds in the post types you would like to use and also checks to make sure your paging still works.

array( 'post', 'linkpost'),'paged'=>$paged ) );
}
?>

if you want to read more about the first piece of code you can check it out on Justin Tadlock’s blog.

WordPress Hosting

Think2Loud had been on shared hosting for just under two years, before I finally decided to take the leap and set up my own server. A few months ago I was reading a blog post by WooThemes about their new hosting setup. After reading about their insane hosting setup, I started doing a little research on VPS.net and came across a great article on Yoast.com about WordPress hosting. So going by what WooThemes had recently setup and what Yoast recommend, I moved Think2Loud to a VPS.net Cloud Server. I couldn’t be happier with the results. Not only does VPS.net have a great product for hosting WordPress but they are also extremely helpful and quick to respond to questions. So if you are looking for new hosting, be sure to check out a VPS.net Cloud Server.

VPS.net WordPress Hosting

Think2Loud doesn’t yet need the power that Yoast.com is running on. I got a VPS.net Cloud Server with the following setup on it, and what’s more, I did it all on my own. Yoast mentions in their WordPress article that if you buy 6 nodes or more, VPS.net will set you up with exactly what they have. Since Think2Loud currently only has about 15K visits a month, I couldn’t justify that much power. With some help from the VPS.net forums and following Yoast’s setup list, this is what I have running:

  • 1 Cloud Server at VPS.net, (2 nodes at the moment, tried 1 and there was just not enough RAM)
  • Centos with CPanel in the Atlanta cloud
  • replaced Apache with LiteSpeed (this really is easy )
  • installed APC so I could do database and output caching with the W3 Total Cache plugin
  • and of course a CDN. I went with MaxCDN because they were the best deal I could find

Pretty simple, right? Now there are a few things that I would like to share with you about VPS.net and the setup they have. I couldn’t find this info anywhere on the web but you may find it valuable. I know it made my day once I signed up and got started.

  • CPanel and WHM are monthly add-ons and VPS.net does the licensing.
  • LiteSpeed is also a monthly add-on and has a CPanel module. VPS.net also takes care of the license.
  • TThere is a small fee for there snapshot service. (Get it! you can never have too many backups).
  • I also setup Rsync on my server with the help of VPS.net. Again, there is a small fee, but it backs up everything.

That’s it! With just a little work, you can have one lean, mean, WordPress hosting machine. Be sure to check out the WordPress hosting article over at Yoast.com, and I would like to thank them for pointing me to a great hosting service.

How to see if a Post in WordPress has an Excerpt

On the single post page for our posts, we wanted to display the excerpt only if one had been entered. Since the built-in WordPress function to get the excerpt for a post will automatically generate one for you, we couldn’t just put the function in our post loop like what was done below.


	
>

Doing this causes the intro of the post to show twice, once from the auto-generated excerpt and once in the post content. To fix this, we added a quick check to the post loop. Simply replacing the_excerpt function in the post loop with this little piece of code removed the double intro.

post_excerpt) ) {
		//We have a excerpt so print it
		the_excerpt();
	} 
?>