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…

3 Jagoan Internet

Posted on 2012/03/06 Comments

Ternyata slogannya emang asli banget, ga ngecewain. Kuenceng, murah, stabil! Dengan modem pas-pasan dan sinyal paling tinggi 40%, gw bisa dapet segini nih:

wp_list_pages() for Custom Post Types

Posted on 2012/02/19 Comments

wp_list_pages() is a handy little function for displaying a list of hierarchical post type, and it works with custom post types too. Unfortunately, when used for a custom post type, the list items don’t have the necessary CSS classes for current page item/ancestors. Here’s a quick fix for this particular problem.

function kct_page_css_class( $css_class, $page, $depth, $args, $current_page ) {
  if ( !isset($args['post_type']) || !is_singular($args['post_type']) )
    return $css_class;

  global $post;
  $current_page  = $post->ID;
  $_current_page = $post;
  _get_post_ancestors($_current_page);

  if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
    $css_class[] = 'current_page_ancestor';
  if ( $page->ID == $current_page )
    $css_class[] = 'current_page_item';
  elseif ( $_current_page && $page->ID == $_current_page->post_parent )
    $css_class[] = 'current_page_parent';

  return $css_class;
}
add_filter( 'page_css_class', 'kct_page_css_class', 10, 5 );

Override max-width

Posted on 2012/02/14 Comments

Just use none :)

.hentry img {height:auto; max-width:100%}
.hentry .someclass img {max-width:none}

KC DropBox

Posted on 2012/02/06 Comments

Here’s a simple plugin for uploading files from your WordPress site front-end. It uses Jaka Jancar’s DropBox Uploader and inspired by a tutorial on WP Tuts+ (although I took a slightly different approach). It’s pretty easy to use and you can integrate it in your contact forms.

Clone/download it from GitHub and feel free to let me know if you have any problem.