add_theme_support( 'automatic-feed-links' );
// Add support for Post Formats
add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'video', 'image', 'quote' ) );
// Add support for custom beckgrounds.
add_theme_support( 'custom-background', array(
// Background color default
'default-color' => '000',
// Background image default
'default-image' => get_template_directory_uri() . '/images/bg.jpg'
) );
}
endif;
add_action( 'after_setup_theme', 'coffee_setup' );
// Add support for custom header
function coffee_custom_header_setup() {
$args = array(
'default-image' => get_template_directory_uri() . '/images/header.jpg',
'width' => apply_filters( 'coffee_header_image_width', 1040 ),
'height' => apply_filters('coffee_header_image_height', 200 ),
'header-text' => true,
'default-text-color' => '990033',
'uploads' => true,
// Callback for styling the header.
'wp-head-callback' => 'coffee_header_style',
// Callback for styling the header preview in the admin.
'admin-head-callback' => 'coffee_admin_header_style',
);
add_theme_support( 'custom-header', $args );
}
add_action( 'after_setup_theme', 'coffee_custom_header_setup' );
if ( ! function_exists( 'coffee_header_style' ) ) :
function coffee_header_style() {
$text_color = get_header_textcolor();
// If no custom options for text are set, let's bail.
if ( $text_color == HEADER_TEXTCOLOR )
return;
// If we get this far, we have custom styles. Let's do this.
?>
__( 'Header Menu', 'coffee' )
) );
// Add widgetized areas
function coffee_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar Widgets', 'coffee' ),
'id' => 'sidebar-1',
'description' => __( 'Widgets displayed in the sidebar on category and archive pages. ', 'coffee' ),
'before_widget' => '",
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'coffee_widgets_init' );
// Adds Title
function coffee_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
// Add the site name.
$title .= get_bloginfo( 'name' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$title $sep $site_description";
// Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'coffee' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'coffee_wp_title', 10, 2 );
// Template for comments and pingbacks.
if ( ! function_exists( 'coffee_comment' ) ) :
function coffee_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
', '' ); ?>
id="li-comment-">
by %7$s', 'coffee' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'coffee' ), get_the_author() ) ),
get_the_author()
);
}
endif;
// Returns a "Continue Reading" link for excerpts
function coffee_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'coffee' ) . '';
}
// Search form custom styling
function coffee_search_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'coffee_search_form' );
// Footer credits.
function coffee_display_credits() {
$text = '' . sprintf( __( 'Proudly powered by %s', 'coffee' ), 'WordPress' ) . '';
$text .= ' | ';
$text .= sprintf( __( 'Theme: %1$s by %2$s', 'coffee' ), 'Coffee', 'OrganikSoft' );
echo apply_filters( 'coffee_credits_text', $text );
}
add_action( 'coffee_credits', 'coffee_display_credits' );