.
add_theme_support( 'automatic-feed-links' );
// Add support for custom backgrounds
add_theme_support( 'custom-background' );
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See suburbia_admin_header_style(), below.
add_theme_support( 'custom-header', apply_filters( 'suburbia_custom_header_args', array(
'default-image' => '%s/images/logo.gif',
'default-text-color' => '835504',
'width' => apply_filters( 'suburbia_header_image_width', 155 ),
'height' => apply_filters( 'suburbia_header_image_height', 155 ),
'wp-head-callback' => 'suburbia_header_style',
'admin-head-callback' => 'suburbia_admin_header_style',
'admin-preview-callback' => 'suburbia_admin_header_image',
) ) );
// This theme uses Featured Images
add_theme_support( 'post-thumbnails' );
// Set thumbnail size.
set_post_thumbnail_size( 155, 110, true );
// Add a custom featured image size.
add_image_size( 'suburbia-thumbnail', 155, 110, true ); // Set thumbnail size
add_image_size( 'suburbia-sticky', 350, 248, true ); // Set thumbnail size for sticky posts in archive view
// This theme uses Custom menu in two locations
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'suburbia' ),
) );
}
endif;
add_action( 'after_setup_theme', 'suburbia_setup' );
// Styles the header image and text displayed on the blog
function suburbia_header_style() {
$header_image = get_header_image();
$header_textcolor = get_header_textcolor();
if ( ! empty( $header_image ) && HEADER_TEXTCOLOR == $header_textcolor )
return;
?>
Header admin panel.
function suburbia_admin_header_style() {
?>
Header admin panel.
function suburbia_admin_header_image() {
?>
__( 'Sidebar', 'suburbia' ),
'id' => 'sidebar-1',
'description' => __( 'An optional sidebar widget area that appears on posts and pages in single view.', 'suburbia' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar(array(
'name'=> __( 'Bottom Area One', 'suburbia' ),
'id' => 'sidebar-2',
'description' => __( 'An optional widget area at the bottom.', 'suburbia' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar(array(
'name'=> __( 'Bottom Area Two', 'suburbia' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget area at the bottom.', 'suburbia' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar(array(
'name'=> __( 'Bottom Area Three', 'suburbia' ),
'id' => 'sidebar-4',
'description' => __( 'An optional widget area at the bottom.', 'suburbia' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name'=> __( 'Bottom Area Four', 'suburbia' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area at the bottom.', 'suburbia' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
// Returns true if a blog has more than 1 category
function suburbia_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
$all_the_cool_cats = get_categories( array(
'hide_empty' => 1,
) );
$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
if ( '1' != $all_the_cool_cats ) {
return true;
} else {
return false;
}
}
// Template for comments and pingbacks.
function suburbia_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="li-comment-">
' . __( 'Continue reading →', 'suburbia' ) . '';
}
// Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and suburbia_continue_reading_link().
function suburbia_auto_excerpt_more( $more ) {
return ' …' . suburbia_continue_reading_link();
}
add_filter( 'excerpt_more', 'suburbia_auto_excerpt_more' );
// Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
function suburbia_enhanced_image_navigation( $url ) {
global $post, $wp_rewrite;
$id = (int) ( $post->ID ?? null );
$object = get_post( $id );
if ( wp_attachment_is_image( $post->ID ?? null ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) )
$url = $url . '#main';
return $url;
}
add_filter( 'attachment_link', 'suburbia_enhanced_image_navigation' );
// Add special classes to the WordPress body class.
function suburbia_body_classes( $classes ) {
if ( ! is_active_sidebar( 'sidebar-1' ) )
$classes[] = 'no-sidebar-widget';
return $classes;
}
add_filter( 'body_class', 'suburbia_body_classes' );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since Suburbia 1.1
*/
function suburbia_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// 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 )
$title .= " $sep " . sprintf( __( 'Page %s', 'suburbia' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'suburbia_wp_title', 10, 2 );
/**
* Load Jetpack compatibility file.
*/
if ( file_exists( get_template_directory() . '/inc/jetpack.php' ) )
require get_template_directory() . '/inc/jetpack.php';