WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 03 2011

Post Formats in WordPress 3.1: Checking for Theme Support and Adding Theme Support

With WordPress 3.1, Post Formats were added, which makes WordPress a hybrid between its traditional CMS/blog environment and Tumblr's quick posting format. This cross or hybrid makes WordPress much more powerful and flexible.

To check to see whether the current theme supports post formats use the following conditional to do nothing if the theme does not support post formats:
[php]if ( !current_theme_supports( 'post-formats' ) || !function_exists( 'get_post_format' ) )
return;[/php]

Or with Genesis:
[php]if ( !current_theme_supports( 'post-formats' ) || !current_theme_supports( 'genesis-post-format-images' ) || !function_exists( 'get_post_format' ) )
return;[/php]

To add theme support for post formats, you will need to add the following:
[php]add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );[/php]

For Genesis child themes, you'll need to add an additional theme support which is used in the genesis function, genesis_do_post_format_image().
[php]add_theme_support( 'genesis-post-format-images' );[/php]

Written by Travis Smith · Categorized: Genesis

Mar 02 2011

Remove Post Title and Page Title from Genesis Child Theme (with or without Post Formats Support)

The same function controls the title for posts and pages; however, to remove the title from one or the other is different. As always open the functions.php in your favorite html/text editor or at Appearance > Editor (or in MS, found under Network Admin). Scroll to the bottom of the page and paste the code below into the functions.php file.

Remove Post Title from Posts

To remove all titles from posts, simply add the following:
[php]//REMOVE POST TITLE
remove_action('genesis_post_title', 'genesis_do_post_title');[/php]

With the introduction of Post Formats in WordPress 3.1, depending on its format, you may want to remove the post title. As it currently stands, has_post_format($arg1, $arg2) can only take a string in $arg1 and $arg2 is optional (and is $post_id), and the supported post formats from WordPress 3.1 are: aside, chat, image, link, quote, status, video, audio, and gallery. So to remove post titles from posts with these formats, simply add the following:
[php]if ( has_post_format( 'aside' ) || has_post_format( 'chat' ) || has_post_format( 'image' ) || has_post_format( 'link' ) || has_post_format( 'quote' ) || has_post_format( 'status' ) || has_post_format( 'video' ) || has_post_format( 'audio' ) || has_post_format( 'gallery' ) ) {
remove_action('genesis_post_title', 'genesis_do_post_title');[/php]

Remove Post Title from Pages

To remove page titles from specific pages, simply add the following:
[php]//REMOVE PAGE TITLE
add_action('get_header', 'child_remove_page_titles');
function child_remove_page_titles() {
$pages=array();
if (is_page($pages)) {
remove_action('genesis_post_title', 'genesis_do_post_title');
}
}[/php]

Or, to remove the title from the home page, simply add the following:
[php]//REMOVE PAGE TITLE FROM HOME PAGE
add_action('get_header', 'child_remove_page_titles');
function child_remove_page_titles() {
if (is_home()) {
remove_action('genesis_post_title', 'genesis_do_post_title');
}
}[/php]

Written by Travis Smith · Categorized: Genesis

Mar 01 2011

How to Find Out What Functions Do In WordPress (& Elsewhere) Using Text Editor like Notepad++

So it became apparent to me as I kept asking people and searching the WordPress Codex where such and such function was defined or used. Now, I have a process that I have refined over time that I want to share. It may not be the best process but it works and works well.

First, as with any web design or development, you need a good text editor. I use Notepad++ since I haven't forked over for a Mac (anyone who wishes to buy me one, please feel free!). Plus Notepad++ is free!

So for example, say I am looking over nav-menus.php from the WordPress core. On line 67, I come across a function called wp_get_object_terms(); So if I want to know what this is, I do one of two things or sometimes both.

  1. First, search the WordPress Codex.
  2. Second, search the WordPress Core Code (online or off).

In this example, the Codex has good information. However, sometimes (though rare) you will see that the Codex is not completely filled out or brought up-to-date or easy to understand without seeing the function.

With the second option, I typically used Yoast's PHPXref (ensuring that I am searching the correct WordPress version) until I was on a plane recently and refused to pay the $10 bucks for wifi since I had everything on my laptop. So then I turned to my text editor. (In the past, I used Windows XP with indexing to find such files; however, I'm now running Windows 7 and the search functions are horrible [and I haven't taken the time to try to figure out what's wrong with Windows 7 search ability or how to improve it]).

So if you open Notepad++, the third menu item is Search. If you click Find in Files a search menu will appear.

Finding WordPress Functions with NotePad++
Click Image for Larger Image

If you hit Ctrl+F as I often do, then select the tab that says Find in Files. Fill in function wp_get_object_terms in the Find what: input box, since I want to find where it's defined to see its accepted variables so I can use it. Then I select the file structure that I want it to search, so you could select the entire WordPress install so it searches wp-admin, wp-includes, and wp-content or just pick one of those folders.

Finding WordPress Functions with NotePad++
Click Image for Larger Image

A quick search reveals that this function is defined in taxonomy.php in the wp-includes folder. The great thing about the search is that it typically returns the entire line that its found, so NotePad++ told me what I was looking for:

function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {

.

Finding WordPress Functions with NotePad++
Click Image for Larger Image

So if I want to see the entire function to try to determine what the function does or returns if anything, I need to open the file. While Notepad++ finds the function, it's not a simple click and open that file. So I have to navigate to the file, open it and go to line 1778 to see the full function. One of the great things about WordPress is that there are a lot of comments informing the user what the function does. For this one particular function, there are 30 lines about this function including the following vital information:

 * @package WordPress
 * @subpackage Taxonomy
 * @since 2.3.0
 * @uses $wpdb
 *
 * @param int|array $object_ids The ID(s) of the object(s) to retrieve.
 * @param string|array $taxonomies The taxonomies to retrieve terms from.
 * @param array|string $args Change what is returned
 * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.

This tells me that $object_ids is either an integer or an array of integers; $taxonomies is a string or an array of strings, and $args is an array of strings that can affect what is returned. It also tells me that this function returns an array or a WP_Error message.

Finding WordPress Functions with NotePad++
Click Image for Larger Image

 

So now, there's an offline version or way to search your WordPress files for function calls, function definitions, etc.

Written by Travis Smith · Categorized: WordPress

Feb 28 2011

Add the Genesis Author Box to Pages

The Genesis tutorials tells how to set up Author Boxes, how to style Author Boxes, and how to add Author Boxes to Author Archive Pages.

As it currently stands, the author box can only be added to the author archive pages and the single post pages. And from what I see, it doesn't appear on pages like http://domain.com/page-name but does appear on http://domain.com/category/post-name. However, what if I wanted to have the author box appear on all the pages or just some or not on some. Well, here's how to do it.

To insert the author box on ALL pages:
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
if ( !is_page() )
return;

if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}

}[/php]

To insert the author box on ALL pages except...
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
$page_exclusions = array(42,'about-me','Contact'); //edit these pages, can take slugs, page names, or page/post ID
if ( ( !is_page() ) || is_page($page_exclusions) )
return;

if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}

}[/php]

To insert the author box on only certain pages:
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
$page_inclusions = array(42,'about-me','Contact'); //edit these pages, can take slugs, page names, or page/post ID
if ( is_page($page_inclusions) ) {
if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}
}
else
return;

}[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Feb 26 2011

Setting Up My WordPress Site with GoDaddy.com

First let it be known that I never encourage anyone to use GoDaddy. If you haven't purchased with GoDaddy already, please consider another host like Hostgator, whom I use. If you've only purchased your domain with GoDaddy, then you are still good. Check out Hostgator. That being said, some of us went ahead and purchased our original first year hosting with GoDaddy. So as not to waste that money (and again, I do not support GoDaddy for a variety of reasons, one being they are horrible for WordPress usage), let's see how to set up your site using GoDaddy.

1. Login to your account & Launch Hosting Control

Login into your account, click My Account, scroll down to Web Hosting and click the launch button to the far right of your domain name under Control Center. Or the much easier way is to the Hosting Control Center and login there. Then click on domain name, which should bring up the Hosting Dashboard.

Install WordPress in GoDaddy
Click Image for Larger Image

2. Install WordPress

There will be two ways to install WordPress. The first and easiest way is to use GoDaddy. The second method is a manual method, which I will not cover here.

  • You should see a button for Install Apps with WordPress under it. Click on WordPress and it will open a new window/tab.
  • Click Install Now.
  • Choose Domain, then click Next.
  • Fill in the database information, then click Next.
Install WordPress in GoDaddy
Click Image for Larger Image
  • Fill in the install directory, then click Next. If you want WordPress to control your whole site be sure to install in the root directory.
Install WordPress in GoDaddy
Click Image for Larger Image
  • Fill in the WordPress configuration information (however, pick a different username than root or admin), then click Finish
Install WordPress in GoDaddy
Click Image for Larger Image

Now this will take a few minutes to a few hours, maybe even days...well it feels that way. However, leave this window open as is.

3. Install FileZilla

Meanwhile, go and download FileZilla. Save the file (*.exe or *.zip). Unzip and then run or run *.exe file. Once installed, run it.

  • Now, your WordPress site should be installed. To check this, simply go back to the window you left open and click on My Applications. It should say Pending or Successfully Installed.

 

Install WordPress in GoDaddy
Click Image for Larger Image
  • For Host, enter your domain name. So if you own domain.com, then enter domain.com. No www is needed.
  • For Username, enter your GoDaddy username.
  • For Password, enter your GoDaddy password.
  • Leave Port empty.
  • Click QuickConnect.

You should see a bunch of words come up in the first box then a file structure appear in the Remote site area. While there may be other files in that folder, you want to navigate to the directory you installed wordpress. If you installed in the root directory, you will see three primary folders that are of interest: wp-admin, wp-content, and wp-includes. Below those folders will be some other WordPress files as signified by the wp- prefix.

4. Login to your Website

Now you should be able to go to domain.com/wp-admin or domain.com/directoryInstalled/wp-admin and login with your WordPress configuration information. Now you are all set to begin customizing, etc.

5. Install Your Theme in GoDaddy

Here's the main reason that you installed FileZilla. "Out of the box" GoDaddy requires you to upload one file at a time which is horrible if you need to install folders, etc. While most want to install a theme that's free, others may want to install premium themes like Genesis or Thesis. To do that, simply download those themes to your desktop and unzip them. Now need to be careful here and get the appropriate folder. When you download most of these premium themes, they typically look like themeName.Version.zip. So when you unzip, they will unzip to folder themeName.Version. Typically you want to go inside that folder and grab the theme folder that typically looks like themeName. To check, enter the folder and be sure you see files and multiple folders if necessary. Then drag the themeName folder to the Themes folder (wp-content/themes/) in FileZilla.

Installing WordPress Theme with GoDaddy
Click Image for Larger Image

Then go to domain.com/wp-admin/themes.php to Activate your theme. Now you are ready to Rock and Roll!

Written by Travis Smith · Categorized: Tutorials

  • « Previous Page
  • 1
  • …
  • 51
  • 52
  • 53
  • 54
  • 55
  • …
  • 60
  • Next Page »

Need Help?

Please let us know how we can help you!

Get Help

Recommendations

Genesis WordPress Framework
Sucuri Security
Gravity Forms
GetSoliloquy
Get Envira
Scribe SEO
BackupBuddy
WordPress Video User Manuals

Recent Posts

  • Solving WordPress 5XX Server Errors on SiteGround
  • Hiding an User in the WordPress Admin
  • Custom Rewrite Rules for Custom Post Types and Taxonomies
  • WordPress JavaScript Manager Native Functions
  • Causes of WordPress Site Performance Slowdown

About Travis

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in