2012-01-11 03:43:23 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2017-06-15 23:17:27 +00:00
|
|
|
* Functions which enhance the theme by hooking into WordPress
|
2012-01-11 03:43:23 +00:00
|
|
|
*
|
|
|
|
* @package _s
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds custom classes to the array of body classes.
|
2013-11-07 19:41:41 +00:00
|
|
|
*
|
|
|
|
* @param array $classes Classes for the body element.
|
|
|
|
* @return array
|
2012-01-11 03:43:23 +00:00
|
|
|
*/
|
|
|
|
function _s_body_classes( $classes ) {
|
2015-09-16 19:08:02 +00:00
|
|
|
// Adds a class of hfeed to non-singular pages.
|
|
|
|
if ( ! is_singular() ) {
|
|
|
|
$classes[] = 'hfeed';
|
|
|
|
}
|
2012-01-11 03:43:23 +00:00
|
|
|
|
2017-07-10 16:03:55 +00:00
|
|
|
// Adds a class of no-sidebar when there is no sidebar present.
|
|
|
|
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
|
|
|
|
$classes[] = 'no-sidebar';
|
|
|
|
}
|
|
|
|
|
2012-01-11 03:43:23 +00:00
|
|
|
return $classes;
|
|
|
|
}
|
|
|
|
add_filter( 'body_class', '_s_body_classes' );
|
2017-06-15 23:17:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a pingback url auto-discovery header for singularly identifiable articles.
|
|
|
|
*/
|
|
|
|
function _s_pingback_header() {
|
|
|
|
if ( is_singular() && pings_open() ) {
|
|
|
|
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_action( 'wp_head', '_s_pingback_header' );
|