There are times when you have two similar categories that you want to merge together. When I say merging, it means:
1. Move all the posts from one category to the other (the one you want to merge into).
2. Delete the duplicate category.
3. Add a URL forwarder to redirect the previous category URL to the new URL.
Here is how it can be done:
Continued…
Posted in Tutorials.
Tagged with categories, merging.
By Damien
– February 18, 2012
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:
Continued…
Posted in Hacks.
Tagged with permalink, rewrite.
By Damien
– February 4, 2012
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.
Posted in Hacks.
Tagged with css, fonts, html editor, wp3.3.
By Damien
– January 18, 2012
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.
Continued…
Posted in Hacks.
Tagged with attribute, height, html tag, image, width.
By Damien
– January 16, 2012
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 »</a></span>';
//if you just want to remove the [...] after the excerpt, use 'return '';'
}
add_filter('excerpt_more', 'new_excerpt_more');
That’s it.
Posted in Hacks.
By Damien
– January 9, 2012
When 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. Continued…
Posted in Hacks.
Tagged with dashboard, widgets.
By Damien
– April 3, 2011
There are many ways to gauge the popularity of a post and the easiest way of them all is to check the posts with the most number of comments.
Here’s now you can display the popular posts (most commented) in the sidebar.
Continued…
Posted in Tutorials.
Tagged with comments, functions, popular, posts, sidebar, widget.
By Damien
– March 4, 2011
Usually when you publish a new post, the post will be pushed to the top of the list in the front page. When your reader click the title link, it will bring them to the full article. Now, what if you want the title of the post, when clicked, direct the reader to an external URL instead of the full article? How can you do it without utilizing a plugin?
We can use custom field to solve this. Here is how you can do so:
Continued…
Posted in Tutorials.
Tagged with external, permalink, rss, title.
By Damien Oh
– March 3, 2011
Custom 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.
Continued…
Posted in Plugins, Tutorials.
Tagged with categories, custom post type, plugins, tags.
By Damien
– March 2, 2011
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:
Continued…
Posted in Hacks.
Tagged with admin bar, functions, slow, WordPress 3.1.
By Damien
– February 28, 2011
How to Show The Most Commented Posts In The Sidebar
There are many ways to gauge the popularity of a post and the easiest way of them all is to check the posts with the most number of comments.
Here’s now you can display the popular posts (most commented) in the sidebar.
Continued…
Posted in Tutorials.
Tagged with comments, functions, popular, posts, sidebar, widget.
Comments Off
By Damien – March 4, 2011