HOWTO: Add Page Slug to Body Class in a WordPress Theme

Even though the body_class() function in WordPress outputs a good deal of classes you can easy use – there are sometimes when having the actual page name as a class is helpful (custom CSS).

Usage Example:

  • Page Named: My Test Page
  • You need the ability to apply some CSS to something only on this page

In your functions.php file – add the following:

/* 
 * Add in page nicename to body class
 * @param $classes = array of class names or a string with space-separated classes names
 */
function sdac_body_page_name_class( $classes ) {
	global $post;
		$classes[] = $post->post_name;
	return $classes;
}
add_filter('body_class', 'sdac_body_page_name_class');

Once that function is in place you will then see this on the test page as a class in the body tag: “my-test-page”. With that in place you can then use something like this to make a page specific change in CSS:

.my-test-page .entry {margin:50px 0 100px 0;} 

HOWTO: Show Page Template Name

A cool function to simply display the path of the WordPress template used on a particular page:

<?php echo get_page_template() ?>

How/when to use this?
If you are trying to debug a site and want to quickly see what page template is used – you can put that PHP code into footer.php and it will then echo out the path so you can quickly and easily see what template is being used.

SDAC Theme: Lucidity Catalog 2.1 Is Available

Lucidity Catalog Theme

Our commercial theme – Lucidity Catalog is now available. This release is a complete re-write and takes advantage of a number of WordPress 2.9+ features. Creating a catalog of items (music, art, etc) into a catalog just got easier.

All catalog items are completely separate from your posts and pages. There are also custom widgets that help display your catalog items in hierarchal list (by item type), a tag cloud, and a custom catalog only search. If you are looking to offer a quick to set up and maintain catalog – check out Lucidity Catalog.

Changes Include:

  • Lucidity Catalog is now a child theme of Lucidity.
  • Catalog uses custom post types, custom taxonomies, featured images, and custom fields.
  • The admin panel has been completely re-vamped and simplified all while giving users more custom options to further customize their catalogs.

Lucidity 2.0 WordPress Theme Released

We rebuilt this theme from the ground up while keeping the same goals in mind that we had for Lucidity’s original release: ease of use, customizable, and fun. We added in a ton of new features, cleaned up the admin, and give you much more customization options.

Features

This new version is full of features to make your site customizable.

  • Use WordPress menus for your header navigation (drop down menus are also available by default)
  • Show/Hide Search in the navigation bar
  • Manage Ads (ROS/Home) for the leaderboard and two sidebar ads (widgets)
  • Define custom meta tags for easy site verification (without touching the theme code)
  • Choose your site colors/font
  • Show your social network links so your visitors can stay connected
  • Auto re-direct your feeds to your Feedburner account
  • Easily add in your Analytic code (Google/Quantcast) (without touching the theme code)

Screenshots

WordPress Theme Wishlist

I have been working on releasing a WordPress theme for awhile now and I keep adding in new functionality instead of just releasing it into the wild. Since I create a lot of custom themes for clients – I am often exposed to a lot of really cool functions, ideas, and designs. Before releasing my initial theme – I wanted to ask for some general feedback.

  1. What is the number 1 thing you want from a theme? Ease of use (admin panels to manage your content), easily skin-able, simple, clean code?
  2. How many people plan to have a mobile theme to handle their content on mobile devices? Would you ideally like this as an option from the get go?
  3. Do you use “all” the theme template files (archive, links, etc?)
  4. What would make you really happy with a theme?

Conditionally Show Only On Home Page (Front Page)

There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog). First – we had the function is_home(), but in WordPress version 2.5 – a new function was introduced: is_front_page().

You might think both would conditionally only display content on the home page (front page, page 1 of your blog) – but you actually need to use the following code to accomplish showing something ONLY on the front page of your paged blog:

<p>Show this text only on the home page</p>

So – if you want to easily show something on what I would consider the front page – use the code above to successfully achieve that. (This is particularly helpful if you have ads that run speficically on the home page and others that are ROS (run of site).

Further reading:

New Condition Tag: is_front_page() (WordPress 2.5)

Great news for WordPress theme developers. WordPress 2.5 now offers a new conditional tag: is_front_page(). We have long lived with other options (is_page(‘home’)) or other logic like that, but the is_front_page() simplifies defining the “home page” in our templates. Thanks guys!

bbPress Templates and Customization

Since we like to develop custom WordPress solutions, we are proud to now offer custom bbPress solutions and templates. bbPress is a light weight and fast forum solution from the makers of WordPress.

bbPressfeatures:

  • Fast and light
  • Simple interface
  • Customizable templates
  • Highly extensible
  • Spam protection
  • RSS Feeds
  • Easy integration with your WordPress web site

If you need a custom install of bbPress, contact us for a free quote.