'000000',
'text' => '808080',
'link' => 'ffffff',
'border' => '272727',
'url' => 'bfbfbf',
);
// this varies but the single page content width seems to be 607px max
$content_width = 600;
// Sidebars
register_sidebar( array(
'name' => __('Footer 1', 'hemingway'),
'id' => 'bottom-1',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
' ) );
register_sidebar( array(
'name' => __('Footer 2', 'hemingway'),
'id' => 'bottom-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
' ) );
register_sidebar( array(
'name' => __('Footer 3', 'hemingway'),
'id' => 'bottom-3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
' ) );
// Load theme options page
require_once( get_stylesheet_directory() . '/theme-options.php' );
function hem_about_block( $content ) {
// resize about page images to fit "about page" block size
// adapted from wp-content/admin-plugins/readomattic.php image_resize()
if ( preg_match_all( '|]+>|i', $content, $images ) ) {
foreach ( $images[0] as $image ) {
if ( preg_match( "|width='(\d+)'|i", $image, $width ) ) {
$w = $width[1];
} else if ( preg_match( '|width="(\d+)"|i', $image, $width ) ) {
$w = $width[1];
} else if ( preg_match( "|width=(\d+)|i", $image, $width ) ) {
$w = $width[1];
} else {
$w = null;
}
if ( preg_match( "|height='(\d+)'|i", $image, $height ) ) {
$h = $height[1];
} else if ( preg_match( '|height="(\d+)"|i', $image, $height ) ) {
$h = $height[1];
} else if ( preg_match( "|height=(\d+)|i", $image, $height ) ) {
$h = $height[1];
} else {
$h = null;
}
if ( $w ) {
list ( $new_w, $new_h ) = wp_constrain_dimensions( $w, $h, 300 ); // fix the max width possible
if ( $new_w != $w ) {
$new_image = str_replace( $width[0], 'width="' . $new_w . '" ', $image);
$new_image = str_replace( $height[0], 'height="' . $new_h . '" ', $new_image);
$content = str_replace( $image, $new_image, $content);
}
}
}
}
return $content;
}
add_theme_support( 'automatic-feed-links' );
// Custom background
add_custom_background();
add_theme_support( 'print-style' );
/**
* Enqueue scripts and styles
*/
function hem_scripts() {
global $hemingway;
wp_enqueue_style( 'hemingway', get_stylesheet_uri() );
if ( $hemingway->style && 'none' != $hemingway->style )
wp_enqueue_style( 'hemingway-scheme', get_template_directory_uri() . '/styles/' . $hemingway->style, array( 'hemingway' ) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'hem_scripts' );
function hem_custom_background() {
if ( '' != get_background_color() || '' != get_background_image() ) { ?>
id="comment-">
is_main_query() )
return;
$query->set( 'posts_per_page', 2 );
}
add_action( 'pre_get_posts', 'hem_home_posts' );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since Hemingway 0.13
*/
function hem_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', 'hemingway' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'hem_wp_title', 10, 2 );