About Damien

Damien Oh is the owner and chief editor of Make Tech Easier

How to Create New Permalink Rules

In WordPress, you can easily create a pretty URL by going to the Settings -> Permalinks section and update the permalink structure. However, if you are creating your own themes or plugins, there are times when you need to create a custom permalink structure.

For example: you want to implement a permalink: http://your-site.com/movies/1 which translates to http://your-site.com/index.php?movies=1.

Here’s how you do it:
Continue reading

How to Change the Font in HTML Editor In WordPress 3.3

The HTML editor in WordPress 3.3 uses monospace font, which is not really friendly to the eyes. Here’s how to change the font to, say, verdana.

1. Open your theme’s functions.php file.

2. Copy and paste the following code:

add_action( 'admin_head-post.php', 'wpdb_fix_html_editor_font' );
add_action( 'admin_head-post-new.php', 'wpdb_fix_html_editor_font' );
 
function wpdb_fix_html_editor_font() { ?>
    <style type="text/css">
        #editorcontainer #content, #wp_mce_fullscreen, .wp-editor-area {
            font-family: Verdana,Arial,sans-serif!important;
        }
    </style>
<?php }

3. Save the functions.php file back to the server.

That’s it.

How to Remove the Width and Height Attributes From WP Image Uploader

If you upload images via the WordPress image uploader and insert it into your post, it will include the image width and height attribute in the html <img> tag. Here’s what it will look like.

<img src="path/to/your/image" width="123" height="456" class="aligncenter size-full" alt="" title=""/>

In most cases, this is absolutely alright. However, if you are using a responsive theme or are dealing with responsive web design, the “width” and “height” attribute will be a major roadblock that you need to get rid of.

Here’s how you can do it.
Continue reading

How to Edit The Excerpt

Changing the Excerpt length

Paste this code to the functions.php of your theme folder.

function custom_excerpt_length( $length ) {
	return 30; //change this number to determine the number of words returned
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Adding “Read More” link after the excerpt

function new_excerpt_more($more) {
        return '... <span class="read-more"><a href="'. get_permalink($post->ID) . '">Read more  &raquo;</a></span>';
       //if you just want to remove the [...] after the excerpt, use 'return '';'
}
add_filter('excerpt_more', 'new_excerpt_more');

That’s it.

How to Remove Miscellaneous Widgets From WP Dashboard

widgets-mainWhen you are logged into your WordPress dashboard, you may have noticed that there are many useless widgets that you don’t even bother looking at it, but it is taking up a long time to load. While you can hide them using the screen options, it is better to remove them for good and prevent them from taking up your precious load time.

Here is how you remove them:

In your functions.php, copy and paste the following code:

add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
function remove_dashboard_widgets() {
	global $wp_meta_boxes;
	unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
	unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
	unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}

What the above code does is to unset the widgets from the dashboard array so that they won’t get loaded in the frontend. If you want to preserve any of the widgets, simply remove them from the above code. Continue reading

How to Create And Handle Custom Post Type

customposttype-sidebarCustom Post Type was introduced in WordPress 3.0 to allow the users to define different post type within a blog. For example, if you are a chef looking to open new cooking classes and also to share your recipes with others, you can define a post type call “Classes” where you announce the availability of new cooking class and another post type call “Recipe” and share your recipe with your readers.

WordPress doesn’t come with an easy way for the normal users to create custom post type, but luckily there is a useful plugin for that.
Continue reading

WordPress 3.1 Very Slow? Disable The Admin Bar [Quick Tip]

Ever since I upgraded to WordPress 3.1, I found that getting around in the admin area becomes very slow. Typing a post in the text editor is extremely laggy and becoming more of a nightmare. Apparently. this was due to the admin bar taking up the system resource. One good way is to disable it for good.

Here’s how you can disable the admin bar:
Continue reading

WordPress 3.1 Hands On

wp-logoIf you are still not aware, WordPress 3.1 was (finally) released on 22nd Feb 2011. The planned release was supposed to be Dec 2010, but apparently there were too many bugs to be fixed and the actual release was delayed by two months. Fortunately WordPress 3.1 is full of goodies and is definitely worth the waiting. Let’s take a look at what’s in store in WP 3.1.

Internal linking

One common practice for most bloggers is to internal link to other article in their blog. The usual way is to open a new tab, search for the article, manually copy the URL and link it in the WordPress text editor. As of WordPress 3.1, you can now internal link right within the text editor.
Continue reading