Entries tagged Hook

Add HTML Tags in Post and Widget Titles

Posted on 2012/05/03 Comments

In a recent project, I needed to use <span /> tags to add some styles (just color, actually) to post and widget titles. By default — and there’s no hook to disable this — WordPress strips any HTML tags found in post and widget titles. Here’s my solution to this problem. Please keep in mind that I only needed to add <span /> tags, so if you need to add more tags, you should modify the code to fit your needs :) Continue…

Hacking Term List Table

Posted on 2012/01/11 Comments

Term list table, unlike post list table, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another.

Continue…

Customize post type archive order

Posted on 2012/01/03 Comments

By now you’re probably already familiar with one of WordPress’ most loved features, custom post type. A custom post type could be hierarchical (like page) or non-hierarchical (like post). This snippet will modify the default posts order when the post type archive is being displayed. Continue…

Remove Protected Post Title Prefix

Posted on 2011/03/27 Comments

By default, WordPress will prefix protected post’s title with Protected. This is good when the password hasn’t been supplied. Unfortunately, it doesn’t remove this prefix when the correct password has been supplied which is not good IMO. Here’s a snippet to ‘fix’ this behavior:
Continue…

Reminder: add_action

Posted on 2011/03/11 Comments

Just a quick reminder, when dynamically adding an action inside an action callback for the same hook, don’t forget to use lower priority for the action you just added.

add_action( 'init', 'my_fuction' );
function my_fuction( $args ) {
    // ...
    add_action( 'init', 'my_other_function', 11 );
}