[wp-hackers] Assigning Custom List Type to Custom Post Type (removing filter by post date)

Tom Barrett tcbarrett at gmail.com
Fri Aug 31 10:17:15 UTC 2012


Thanks for the replies everyone!

I have for now applied a body_class and hidden the filter with jQuery.
Posted my 'solution' on forums, will supply at the end of this email too.

I don't personally know whether the core solution should be the ability to
extend the class, or via filters. "Hooks and filters" is my usual mantra to
others, but I'm sure the core devs are much better suited to answer that.

I would like to contribute, and it probably is the oldest and lamest excuse
ever, but I don't have the time to contribute (what I would feel to be)
constructively. So as much I would love to submit a trac ticket (
http://core.trac.wordpress.org/) perhaps I'd be better off leaving it in
the ideas section (http://wordpress.org/extend/ideas/).

Tom


PHP
add_filter( 'admin_body_class', 'tcb_admin_body_class' );
function tcb_admin_body_class( $classes ){
  $screen = get_current_screen();

  if( is_array($classes) ) :
    $classes[] = $screen->post_type;
  else :
    $classes .= ' ' . $screen->post_type;
  endif;

  return $classes;
}

JavaScript
jQuery('body.post-type .tablenav.top .actions:nth-child(1)').hide();
-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list