__( 'Primary Navigation', 'adams-razor' ),
) );
$options = get_option('adamsrazor_theme_options');
if ($options['supress_wp_generator']==1)
remove_action('wp_head', 'wp_generator');
}
endif;
// Custom header
$args = array(
'flex-height' => true,
'height' => 300,
'flex-width' => true,
'width' => 1600,
'default-image' => get_template_directory_uri() . '/default/header.jpg',
'random-default' => false,
'default-text-color' => '',
'header-text' => false,
'uploads' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $args );
// Show home link in menu
function adamsrazor_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'adamsrazor_page_menu_args' );
// Excerpt
function adamsrazor_excerpt_length( $length ) {
return 140;
}
add_filter( 'excerpt_length', 'adamsrazor_excerpt_length' );
// Continue reading text
function adamsrazor_continue_reading_link() {
return ' ' . __( 'Continue reading »', 'adams-razor' ) . '';
}
// Auto excerpt
function adamsrazor_auto_excerpt_more( $more ) {
return ' …' . adamsrazor_continue_reading_link();
}
add_filter( 'excerpt_more', 'adamsrazor_auto_excerpt_more' );
// Custom excert
function adamsrazor_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= adamsrazor_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'adamsrazor_custom_excerpt_more' );
// Remove default gallery inline CSS
function adamsrazor_remove_default_gallery_css ( $css ) {
return str_replace("border: 2px solid #cfcfcf;", "", $css);
}
add_filter('gallery_style', 'adamsrazor_remove_default_gallery_css' );
// Define widgets
function adamsrazor_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Widget Area', 'adams-razor' ),
'id' => 'primary-widget-area',
'description' => __( 'Widget area to right of content. SUGGESTION: This is a useful place to include a Sub Pages Widget to show child navigation.', 'adams-razor' ),
'before_widget' => '
',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'adams-razor' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first (left) footer widget area', 'adams-razor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'adams-razor' ),
'id' => 'second-footer-widget-area',
'description' => __( 'The second (middle) footer widget area', 'adams-razor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'adams-razor' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third (right) footer widget area', 'adams-razor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'adamsrazor_widgets_init' );
// Formatting of date on posts
if ( ! function_exists( 'adamsrazor_post_meta_date' ) ) :
function adamsrazor_post_meta_date() {
printf( __( 'Published on %2$s by %3$s', 'adams-razor' ),
'meta-prep meta-prep-author',
sprintf( '%1$s',
get_the_date()
),
sprintf( '%3$s',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View more from %s', 'adams-razor' ), get_the_author() ),
get_the_author()
)
);
}
endif;
// Formatting of categories
if ( ! function_exists( 'adamsrazor_posted_in' ) ) :
function adamsrazor_posted_in() {
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark this page.', 'adams-razor' );
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in = __( 'This entry was posted in %1$s. Bookmark this page.', 'adams-razor' );
} else {
$posted_in = __( 'Bookmark this page.', 'adams-razor' );
}
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
endif;
// remove inline style from captions
// adapted from: http://troychaplin.ca/2012/06/updated-function-fix-inline-style-that-added-image-caption-wordpress-3-4/
add_shortcode('wp_caption', 'adamsrazor_fixed_img_caption_shortcode');
add_shortcode('caption', 'adamsrazor_fixed_img_caption_shortcode');
function fixed_img_caption_shortcode($attr, $content = null) {
if ( ! isset( $attr['caption'] ) ) {
if ( preg_match( '#((?:]+>\s*)?
]+>(?:\s*)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
}
$output = apply_filters('img_caption_shortcode', '', $attr, $content);
if ( $output != '' ) {
return $output;
}
extract(shortcode_atts(array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
), $attr));
if ( 1 > (int) $width || empty($caption) ) {
return $content;
}
// adaption ($custom width used in returl below)
$custom_width = "32em"; //max width for bigger images
if ($width < 528) $custom_width = $width . 'px';
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return '' . do_shortcode( $content ) . '
' . $caption . '
';
}
// Custom comment form
if ( ! function_exists( 'adamsrazor_comment' ) ) :
function adamsrazor_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
id="li-comment-">