Skip to content

Commit 8cc6b89

Browse files
committed
Added body_class filter.
1 parent a6e7ac3 commit 8cc6b89

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

jquery.com/category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php get_header(); ?>
2-
<div class="content-right twelve columns listing">
2+
<div class="content-right twelve columns">
33
<div id="content">
44

55
<?php if ( have_posts() ) : ?>

jquery.com/functions.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
// Add body classes found in postmeta.
4+
add_filter( 'body_class', function( $classes ) {
5+
$classes = array( 'jquery' );
6+
7+
if ( is_page() )
8+
$classes[] = 'page-slug-' . sanitize_html_class( strtolower( get_queried_object()->post_name ) );
9+
if ( is_singular() && $post_classes = get_post_meta( get_queried_object_id(), 'body_class', true ) )
10+
$classes = array_merge( $classes, explode( ' ', $post_classes ) );
11+
12+
if ( is_archive() || is_search() ) {
13+
$classes[] = 'listing';
14+
}
15+
16+
return $classes;
17+
});

0 commit comments

Comments
 (0)