html tag to the category item */ add_filter( 'wp_list_categories', array( $this, 'add_span_cat_count' ) ); add_filter( 'get_archives_link', array( $this, 'add_span_archive_count' ) ); } /** * Filter the categories widget to add a element before the count * * @param $links * * @return mixed */ public function add_span_cat_count( $links ) { $links = str_replace( ' (', ' ', $links ); $links = str_replace( ')', '', $links ); return $links; } /** * Filter the archives widget to add a element before the count * * @param $links * * @return mixed */ public function add_span_archive_count( $links ) { $links = str_replace( ' (', ' ', $links ); $links = str_replace( ')', '', $links ); return $links; } /** * @param $title * * @return string|void */ public function remove_from_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = '' . get_the_author() . ''; } return $title; } /** * Flush out the transients used in bumbeelbee_categorized_blog. */ public function category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'bumbeelbee_categories' ); } /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * * @return array */ public function body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } /** * @param $content * * @return mixed|string */ public function add_plyr_layout( $content ) { if ( ! is_single() ) { return $content; } // has normal video // remove video tag preg_match( '/\[video.*?\]/', $content, $matches ); if ( ! empty( $matches ) ) { preg_match_all( '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $matches[0], $match ); if ( ! empty( $match ) && filter_var( $match[0][0], FILTER_VALIDATE_URL ) ) { $content = preg_replace( '/\[video.*?\]/', '', $content ); $content = preg_replace( '/\[\/video.*?\]/', '', $content ); $html = '
'; $html .= ''; $html .= '
'; return $html . $content; } }; return $content; } /** * @param $html * * @return string */ public function fix_responsive_videos( $html ) { return '
' . $html . '
'; } /** * */ public function get_attachment_image() { $id = intval( $_POST['attachment_id'] ); $size = esc_html( $_POST['attachment_size'] ); $src = wp_get_attachment_image( $id, false ); echo $src; die(); } }