I'm moving on from the child of a (no-longer serviced) 2009 theme to a child of twenty sixteen - I previously had a code in my functions that generated the week number as a body class - e.g w32 (for this week for example.)
I'm using the following code in my old theme but of course it no longer functions in twenty sixteen. Are there any tips to implement it there? The following is in the functions.php of my child folder:
// Adds 'week' and parent-page id body-class add_filter( 'hybrid_body_class', 'my_body_class' ); function my_body_class( $class ) { global $wp_query; $time = time() + ( get_option( 'gmt_offset' ) * 3600 ); $class .= ' w' . gmdate( 'W', $time ); if ( is_page() && $wp_query->post->post_parent ) $class .= ' parent-' . $wp_query->post->post_parent; return $class; } As I'm no longer using the hybrid theme, I've tried changing hybrid_body_class to body_class and multiple other variants - to no avail or with errors...