32,
'width' => 150,
'flex-width' => true,
'flex-height' => true,
));
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'bisonno' ),
'social' => esc_html__( 'Social Menu', 'bisonno' )
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/**
* Return entry full featured image path
*/
if ( ! function_exists ( 'bisonno_entry_feature_image_path' ) ) {
function bisonno_entry_feature_image_path() {
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
echo esc_url($featured_image[0]);
}
}
/**
* Add CSS `o-grid__col--4-4-m o-grid__col--2-3-l` class to last post in the home page
*/
if ( ! function_exists ( 'bisonno_post_grid_class' ) ) {
function bisonno_post_grid_class( $classes ) {
global $wp_query;
if ( is_home() && !is_paged() ) {
if ( 0 == $wp_query->current_post ) {
$classes[] = 'o-grid__col--4-4-m o-grid__col--2-3-l';
}
}
return $classes;
}
}
if ( ! get_theme_mod( 'bisonno_homepage_3_column_recent_posts' ) ) {
add_filter( 'post_class', 'bisonno_post_grid_class' );
}
/**
* Add CSS `c-post-card--first` class to last post in the home page
* Add CSS `c-post-card--half` class to the second and third posts in the home page
*/
if ( ! function_exists ( 'bisonno_post_class' ) ) {
function bisonno_post_class( ) {
$classes = '';
global $wp_query;
if ( is_home() && !is_paged() ) {
if ( 0 == $wp_query->current_post ) {
$classes = 'c-post-card--first';
}
if( 1 == $wp_query->current_post ) {
$classes = 'c-post-card--half';
}
}
echo esc_html($classes);
}
}
/**
* Custom more text for the excerpt more
*/
function bisonno_custom_excerpt_more( $more ) {
return ' ...';
}
add_filter( 'excerpt_more', 'bisonno_custom_excerpt_more' );
/**
* Add CSS class to custom logo
*/
function bisonno_custom_logo_class( $html ) {
$html = str_replace('custom-logo', 'c-logo', $html);
return $html;
}
add_filter( 'get_custom_logo', 'bisonno_custom_logo_class' );
/**
* Remove p tags from archive description
*/
function bisonno_custom_archive_description( $description ) {
$remove = array( '', '
' );
$description = str_replace( $remove, '', $description );
return $description;
}
add_filter( 'get_the_archive_description', 'bisonno_custom_archive_description' );
/**
* Remove parentheses from category list and add span class to posts count
*/
function bisonno_categories_postcount_filter( $variable ) {
$variable = str_replace( '(', ' ', $variable );
$variable = str_replace( ')', ' ', $variable );
return $variable;
}
add_filter( 'wp_list_categories', 'bisonno_categories_postcount_filter' );
/**
* Remove parentheses from archive list and add span class to posts count
*/
function bisonno_archive_postcount_filter( $variable ) {
$variable = str_replace( '(', ' ', $variable );
$variable = str_replace( ')', ' ', $variable );
return $variable;
}
add_filter( 'get_archives_link', 'bisonno_archive_postcount_filter' );
/**
* Replace class on reply link
*/
function bisonno_replace_reply_link_class( $class ) {
$class = str_replace( "class='comment-reply-link", "class='c-btn tiny", $class );
return $class;
}
add_filter( 'comment_reply_link', 'bisonno_replace_reply_link_class' );
/**
* Replace class on cancel reply link
*/
function bisonno_replace_cancel_reply_link_class( $cancel_comment_reply_link, $post = null ) {
$new = str_replace( ''
* https://raam.org/2013/personalizing-the-wordpress-comment-reply-link/
*/
function bisonno_add_comment_author_to_reply_link( $link, $args, $comment ) {
$comment = get_comment( $comment );
$author = $comment->comment_author;
// If the user provided more than a first name, use only first name
if( strpos( $author, ' ' ) ) {
$author = substr( $author, 0, strpos( $author, ' ' ) );
}
// Replace Reply Link with "Reply to Author First Name>"
$reply_link_text = $args['reply_text'];
$link = str_replace( $reply_link_text, esc_html__( 'Reply to', 'bisonno' ) . ' ' . $author, $link );
return $link;
}
add_filter( 'comment_reply_link', 'bisonno_add_comment_author_to_reply_link', 10, 3 );
/**
* Add Placehoder in comment Form Field (Comment)
*/
function bisonno_comment_textarea_placeholder( $fields ) {
$fields['comment_field'] = str_replace(
'