1920,
'height' => 100,
'flex-width' => true,
'flex-height' => true,
'uploads' => true,
'header-text' => true,
'default-text-color' => 'fff',
'wp-head-callback' => 'city_informer_header_style',
);
add_theme_support( 'custom-header', $args );
/* Adds RSS feed links to
for posts and comments. */
add_theme_support( 'automatic-feed-links' );
/* Styles the visual editor with editor-style.css */
add_editor_style();
/* Styles for default background arguments */
$background_args = array (
'default-color' => 'e3e3e3',
'default-image' => get_template_directory_uri() . '/images/background.jpg',
);
add_theme_support( 'custom-background', $background_args );
/* Register navigation menu */
register_nav_menus ( array( 'header-menu' => 'Main Menu' ) );
/* set content width */
if ( ! isset( $content_width ) )
$content_width = 620;
}
/* title filter */
function city_informer_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
/* Add the site name. */
$site_title = get_bloginfo( 'name' );
/* Add the site description for the home/front page. */
$site_description = get_bloginfo( 'description', 'display' );
$sep = '«';
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$site_title $sep $site_description";
/* Add a page number if necessary. */
if ( 2 <= $paged || 2 <= $page )
$title = "$title $sep " . sprintf( __( 'Page', 'city_informer' ) . ' %s', max( $paged, $page ) );
return $title;
}
/* Registers main widget area */
function city_informer_register_widget() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'city_informer' ),
'id' => 'sidebar-widgets',
'before_widget' => '' . sprintf( $text['home'] ) . ' ' . $delimiter . ' ';
if ( is_category() ) {
$this_cat = get_category( get_query_var( 'cat' ), false );
if ( $this_cat->parent != 0 )
echo get_category_parents( $this_cat->parent, true, ' ' . $delimiter . ' ' );
echo $before . sprintf( $text['category'], single_cat_title( '', false ) ) . $after;
} elseif ( is_search() ) {
echo $before . sprintf( $text['search'], get_search_query() ) . $after;
} elseif ( is_day() ) {
echo '
' . get_the_time( 'Y' ) . ' ' . $delimiter . ' ';
echo '
' . get_the_time( 'F' ) . ' ' . $delimiter . ' ';
echo $before . get_the_time( 'd' ) . $after;
} elseif ( is_month() ) {
echo '
' . get_the_time( 'Y' ) . ' ' . $delimiter . ' ';
echo $before . get_the_time( 'F' ) . $after;
} elseif ( is_year() ) {
echo $before . get_the_time( 'Y' ) . $after;
} elseif ( is_single() && ! is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object( get_post_type() );
$slug = $post_type->rewrite;
echo '
' . $post_type->labels->singular_name . '';
if ( $show_current == 1 )
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
$cats = get_category_parents( $cat, true, ' ' . $delimiter . ' ' );
if ( $show_current == 0 )
$cats = preg_replace( "#^(.+)\s$delimiter\s$#", "$1", $cats );
echo $cats;
if ( $show_current == 1 )
echo $before . get_the_title() . $after;
}
} elseif ( ! is_single() && ! is_page() && get_post_type() != 'post' && ! is_404() ) {
$post_type = get_post_type_object( get_post_type() );
echo $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post( $post->post_parent );
$cat = get_the_category( $parent->ID ); $cat = $cat[0];
echo get_category_parents( $cat, true, ' ' . $delimiter . ' ' );
echo '
' . $parent->post_title . '';
if ( $show_current == 1 )
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
} elseif ( is_page() && ! $post->post_parent ) {
if ( $show_current == 1 )
echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = '
' . get_the_title( $page->ID ) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse( $breadcrumbs );
for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) {
echo $breadcrumbs[ $i ];
if ( $i != count( $breadcrumbs )-1 )
echo ' ' . $delimiter . ' ';
}
if ( $show_current == 1 )
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
} elseif ( is_tag() ) {
echo $before . sprintf( $text['tag'], single_tag_title( '', false ) ) . $after;
} elseif ( is_author() ) {
$userdata = get_userdata( $author );
echo $before . sprintf( $text['author'], $userdata->display_name ) . $after;
} elseif ( is_404() ) {
echo $before . sprintf( $text['404'], '' ) . $after;
}
echo '
';
}
} // end city_informer_breadcrumbs
// Post caption for thumbnail
function city_informer_the_post_caption( $size = '', $attr = '' ) {
global $post;
$thumb_id = get_post_thumbnail_id( $post->ID );
$args = array(
'post_type' => 'attachment',
'post_status' => null,
'parent' => $post->ID,
'include' => $thumb_id,
);
$thumbnail_image = get_posts( $args );
if ( $thumb_id && $thumbnail_image && isset( $thumbnail_image[0] ) ) {
// Showing the thumbnail caption
$caption = $thumbnail_image[0]->post_excerpt;
if( $caption ) {
$output = '