* * @param array $classes Classes for the article element * @return array */ function dro_pizza_article_classes($classes) { if (is_single()) { $classes[] = 'row'; } if(is_front_page() || is_archive() || is_search()){ $classes[] = 'post-item'; } return $classes; } endif; add_filter('post_class', 'dro_pizza_article_classes'); /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function dro_pizza_pingback_header() { if (is_singular() && pings_open()) { printf('', esc_url(get_bloginfo('pingback_url'))); } } add_action('wp_head', 'dro_pizza_pingback_header'); if ( !function_exists( 'dro_pizza_image_header' ) ){ /** * Return the background image for header */ function dro_pizza_image_header(){ if(is_home() || is_front_page()): return get_header_image(); endif; if( is_single() || is_page() ): return get_the_post_thumbnail_url(); endif; return FALSE; } } if ( !function_exists( 'dro_pizza_sidebar_status' ) ) { /* * Whether a sidebar is in use */ function dro_pizza_sidebar_status($sidebar) { if (is_active_sidebar($sidebar)) { return TRUE; } } } add_action('after_setup_theme', 'dro_pizza_sidebar_status'); if (!function_exists('dro_piza_get_excerpt')) { /** * Limit the excerpt by number of characters but do NOT truncate the last word. * * @global object $post * @param int $limit * @param string $source * @return string */ function dro_piza_get_excerpt($limit, $source = null) { global $post; $excerpt = $source == "content" ? get_the_content() : get_the_excerpt(); $excerpt = preg_replace(" (\[.*?\])", '', $excerpt); $excerpt = substr($excerpt, 0, $limit); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace('/\s+/', ' ', $excerpt)); return wp_kses($excerpt, 'post'); } } if (!function_exists('dro_pizza_is_active_sidebar')) { /** * Check if sidebar is active */ function dro_pizza_is_active_sidebar($index) { global $wp_registered_sidebars; $widgetcolums = wp_get_sidebars_widgets(); if ($widgetcolums[$index]) return true; return false; } } /** * Remove archive title prefixes. * * @param string $title The archive title from get_the_archive_title(); * @return string The cleaned title. */ function dro_pizza_custom_archive_title( $title ) { // Remove any HTML, words, digits, and spaces before the title. return preg_replace( '#^[\w\d\s]+:\s*#', '', strip_tags( $title ) ); } add_filter( 'get_the_archive_title', 'dro_pizza_custom_archive_title' );