Add classes + taxonomy terms to wp_list_pages() output

Doesn’t WordPress already at the class current_page_parent, current_page_ancestor and current_page_item (see source). The filter you are using is called on 1046. As for your question, you create the array $content_type and then attempt to make a string out of $the_content_type. Try: function wpse56088_page_css_class( $css_class, $page, $depth, $args, $current_page ){ $terms = get_the_terms( $page->ID, ‘content-type’ ); … Read more

Date based CSS/theme

I php you can create an anchor class based on the desired date. I haven’t tested it, but it should be something like this: // your relevant html parent element <div class=”<?php echo getOlderPostsClassName( ‘5/5/2012’,the_time() ); ?>”> function getOlderPostsClassName($untilDate, $wordpressPostDate) { $start = strtotime($untilDate); $end = strtotime($wordpressPostDate); if ($start-$end > 0) { return ‘My_css_class_for_older_posts’; } … Read more

How to format the first line of a post differently?

Here is the idea add_filter(‘the_content’, ‘testfunc’); function custom_formatter($matches){ return “<strong>{$matches[0]}</strong>”; } function testfunc($content) { $pattern = “$\<p.*\>(.*)\<\/p\>$”; $content = preg_replace_callback($pattern, ‘custom_formatter’, $content); return $content; } However, you will need a better regular expression in $pattern variable as this regex may be very poor. in the custom_formatter function you can do the formattings you want.

Target admin page body via CSS class

Found this, but it really should be in WordPress Core: // Body class for admin // http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/ function base_admin_body_class( $classes ) { // Current action if ( is_admin() && isset($_GET[‘action’]) ) { $classes .= ‘action-‘.$_GET[‘action’]; } // Current post ID if ( is_admin() && isset($_GET[‘post’]) ) { $classes .= ‘ ‘; $classes .= ‘post-‘.$_GET[‘post’]; } … Read more