` tag
if ( ! is_singular() ) {
if ( strpos( $post->post_content, '' ) ) {
$classes[] = 'has-read-more-tag';
} else {
$classes[] = 'no-read-more-tag';
}
}
// Check if sticky post
if ( ! is_sticky() ) {
$classes[] = 'no-sticky';
}
// Check if use excerpt for blog page
$content = bulan_mod( $prefix . 'blog-content' );
if ( $content == 'excerpt' && !is_singular() ) {
$classes[] = 'use-excerpt';
}
return $classes;
}
add_filter( 'post_class', 'bulan_post_classes' );
if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) :
/**
* Filters wp_title to print a neat
tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function bulan_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
}
global $page, $paged;
// Add the blog name
$title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description";
}
// Add a page number if necessary:
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( __( 'Page %s', 'bulan' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'bulan_wp_title', 10, 2 );
/**
* Title shim for sites older than WordPress 4.1.
*
* @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
* @todo Remove this function when WordPress 4.3 is released.
*/
function bulan_render_title() {
?>
' . __( 'Continue Reading', 'bulan' ) . '';
}
add_filter( 'excerpt_more', 'bulan_excerpt_more' );
/**
* Change the excerpt length.
*
* @since 1.0.0
* @param string $more
* @return string
*/
function bulan_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'bulan_excerpt_length', 999 );
/**
* Remove theme-layouts meta box on attachment and bbPress post type.
*
* @since 1.0.0
*/
function bulan_remove_theme_layout_metabox() {
remove_post_type_support( 'attachment', 'theme-layouts' );
// bbPress
remove_post_type_support( 'forum', 'theme-layouts' );
remove_post_type_support( 'topic', 'theme-layouts' );
remove_post_type_support( 'reply', 'theme-layouts' );
}
add_action( 'init', 'bulan_remove_theme_layout_metabox', 11 );
/**
* Modifies the theme layout on attachment pages.
*
* @since 1.0.0
*/
function bulan_mod_theme_layout( $layout ) {
if ( is_attachment() && wp_attachment_is_image() ) {
$post_layout = get_post_layout( get_queried_object_id() );
if ( 'default' === $post_layout ) {
$layout = '1c';
}
}
return $layout;
}
add_filter( 'theme_mod_theme_layout', 'bulan_mod_theme_layout', 15 );
/**
* Extend archive title
*
* @since 1.0.0
*/
function bulan_extend_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'bulan_extend_archive_title' );
/**
* Customize tag cloud widget
*
* @since 1.0.0
*/
function bulan_customize_tag_cloud( $args ) {
$args['largest'] = 12;
$args['smallest'] = 12;
$args['unit'] = 'px';
$args['number'] = 20;
return $args;
}
add_filter( 'widget_tag_cloud_args', 'bulan_customize_tag_cloud' );
/**
* Add custom fields to the author profile fields
*
* @since 1.0.0
*/
function bulan_new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
$contactmethods['gplus'] = 'Google Plus';
$contactmethods['instagram'] = 'Instagram';
$contactmethods['linkedin'] = 'Linkedin';
// Display the new fields
return $contactmethods;
}
add_filter( 'user_contactmethods', 'bulan_new_contactmethods', 10, 1 );