for posts and comments.
add_theme_support( 'automatic-feed-links' );
// Adds support for a custom header image.
add_theme_support( 'custom-header',
array(
// Text color and image (empty to use none).
'default-text-color' => '333333',
'default-image' => '',
// Set height and width, with a maximum value for the width.
'height' => 128,
'width' => 960,
'max-width' => 960,
// Support flexible height and width.
'flex-height' => true,
'flex-width' => false,
// Random image rotation off by default.
'random-default' => false,
// Callbacks for styling the header and the admin preview.
'wp-head-callback' => 'blogotron_header_style',
'admin-head-callback' => 'blogotron_admin_header_style',
'admin-preview-callback' => 'blogotron_admin_header_image'
)
);
// This theme supports custom background color and image
add_theme_support( 'custom-background',
array(
'default-color' => 'f5f5f5'
)
);
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'main', __( 'Main Menu', 'blogotron' ) );
// This theme uses a custom image size for featured images, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
add_image_size( 'post-featured-image', 528, 9999 ); // Unlimited height, soft crop
// Adds support Shortcodes in sidebar widgets.
add_filter( 'widget_text', 'do_shortcode' );
}
// Registers main widget area area.
function blogotron_sidebar() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'blogotron' ),
'id' => 'main-sidebar',
'description' => __( 'Widgets for the sidebar.', 'blogotron' ),
'before_widget' => '',
'before_title' => '
'
) );
}
// Enqueues scripts and styles for front-end.
function blogotron_scripts_styles() {
// Loads our main stylesheet.
wp_enqueue_style( 'blogotron-style', get_template_directory_uri() . '/style.css', false, NULL );
//Adds main JavaScript.
wp_enqueue_script( 'blogotron-core-script', get_template_directory_uri() . '/js/script.js', array( 'jquery' ), NULL, false );
// Enqueue JavaScript translated variables.
wp_enqueue_script( 'blogotron-variables', blogotron_script_variables() );
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'blogotron-ie-style', get_template_directory_uri() . '/styles/ie.css', false, NULL );
wp_style_add_data( 'blogotron-ie-style', 'conditional', 'lt IE 9' );
// Adds JavaScript to pages with the comment form to support sites with threaded comments (when in use).
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
// Sets up translated text for variables JavaScript.
function blogotron_script_variables() { ?>
Header admin panel.
function blogotron_admin_header_style() { ?>
Header admin panel.
function blogotron_admin_header_image() { ?>
', '« %title' );
previous_post_link( '%link
', '%title »' ); ?>
%1$s%2$s', __( 'Archives for: ', 'blogotron' ), get_the_date( 'd F Y' ) );
elseif ( is_month() ) :
printf( '%1$s%2$s', __( 'Archives for: ', 'blogotron' ), get_the_date( 'F Y' ) );
elseif ( is_year() ) :
printf( '%1$s%2$s', __( 'Archives for: ', 'blogotron' ), get_the_date( 'Y' ) );
elseif ( is_category() ) :
printf( '%1$s%2$s', __( 'Category: ', 'blogotron' ), single_cat_title( '', false ) );
elseif ( is_tag() ) :
printf( '%1$s%2$s', __( 'Tag: ', 'blogotron' ), single_tag_title( '', false ) );
else :
printf( '%s', __( 'Archives', 'blogotron' ) );
endif;
}
// Show caption to featured images, if it exists.
function blogotron_the_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail_image = get_posts( array( 'p' => $thumbnail_id, 'post_type' => 'attachment' ) );
if ( ! empty( $thumbnail_image[0]->post_excerpt ) ) {
printf( '%s
', $thumbnail_image[0]->post_excerpt );
}
}
// Get attachment image, caption and metadata.
function blogotron_the_attachment() {
global $post;
$attachment = wp_prepare_attachment_for_js( get_the_id() ); ?>
![<?php echo $attachment[ 'title' ]; ?> <?php echo $attachment[ 'title' ]; ?>](<?php echo $attachment[ 'url' ]; ?>)
%s', $attachment[ 'caption' ] );
} ?>
comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments. ?>
id="comment-">
id="li-comment-">
comment_type
}
add_action( 'after_setup_theme', 'blogotron_setup' );
add_action( 'widgets_init', 'blogotron_sidebar' );
add_action( 'wp_enqueue_scripts', 'blogotron_scripts_styles' );
add_filter( 'wp_title', 'blogotron_title' );
add_filter( 'comment_class', 'blogotron_comment_class' );
add_action( 'blogotron_page_nav', 'blogotron_page_nav' );
add_action( 'blogotron_post_nav', 'blogotron_post_nav' );
add_action( 'blogotron_archive_title', 'blogotron_archive_title' );
add_action( 'blogotron_the_thumbnail_caption', 'blogotron_the_thumbnail_caption' );
add_action( 'blogotron_the_attachment', 'blogotron_the_attachment' );
?>