How to Find Free WordPress Themes

There are a lot of great WordPress themes available for free, but you’ll need to be careful about where you get them from. Bad themes with malicious code can bring down your server, alter links on your website, and cause other unsavory problems.

Free themes from reputable sources can be terrific though. Here’s some of the places I’d check first, with a few example themes from each.

WordPress.org

The theme repository on WordPress.org is the largest source of free WordPress themes. All themes go through a detailed code review and safe to use on your site. You can browse the featured themes, popular themes, and newest themes.

Expound

Some excellent free themes to try in the repository are Expound, Spun, and Bold Headlines.
Continue reading

Convert Custom Post Types

Some themes and plugins use custom post types to store data for items like portfolio pieces or testimonials . This can be an issue if you want to switch to a new theme that doesn’t have support for that post type, or your plugin is no longer maintained.

Luckily, there’s a couple ways to convert custom post types to standard post types. I recommend using Post Type Switcher if you just have a couple items to switch. For converting posts in bulk, Convert Post Types is what you’ll want.

Convert Post Types Overview

Plugins Mentioned

Themes Mentioned

Drop Down Menu Indicator

Update: Menu items now have the class “menu-item-has-children” that can be used for styling thank to this core ticket. So, the menu walker is no longer needed.

I think it’s important to give users a visual cue when menu items have a drop down menu.

One way I’ve handled this in the past is to use the Superfish jQuery plugin, which adds a class to any list items with children. This allows them to be styled differently- with a background image of a down arrow (for instance).

menu-example

However, I just saw a new theme released by Paul de Wouters called Spine. Instead of using javascript to apply the class- he uses a custom Walker_Nav_Menu so that the class is added to the markup directly.

I think this is a much better way to do it, and solves an issue I’ve seen in some themes where the menu items shift a bit when the new classes and styling are applied with javascript.
Continue reading

Translatable Javascript Strings

I’ve been working on a plugin that needs to update the text of an object via javascript when an element is clicked. Like the rest of my plugin, those strings in the javascript need to be translatable. Thankfully WordPress makes this easy to do.

Original

Let’s say this is the script you are enqueuing:

function prefix_enqueue_custom_script(){
	wp_register_script( 'prefix_custom_script', plugin_dir_url( __FILE__ ) .'js/custom-script.js', array( 'jquery' ) );
        wp_enqueue_script( 'prefix_custom_script' );
}

Translatable

In this custom script there are two strings that should be translatable: “upload” and “remove”. To make this happen we’ll use the wp_localize_script function, which gets hooked onto the script handle:

function prefix_enqueue_custom_script(){
	wp_register_script( 'prefix_custom_script', plugin_dir_url( __FILE__ ) .'js/custom-script.js', array( 'jquery' ) );
        wp_enqueue_script( 'prefix_custom_script' );
        wp_localize_script( 'prefix_custom_script', 'prefix_object_name', array(
		'upload' => __( 'upload', 'textdomain' ),
		'remove' => __( 'remove', 'textdomain' )
	) );
}

Using the Strings

Now in my javascript, instead of simply using the text “upload” and “remove” I’ll use the variables prefix_object_name.upload and prefix_object_name.remove.