__( 'Primary Navigation', 'theme-adamsrazor' ),
) );
remove_action('wp_head', 'wp_generator');
}
endif;
function adamsrazor_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'adamsrazor_page_menu_args' );
function adamsrazor_excerpt_length( $length ) {
return 140;
}
add_filter( 'excerpt_length', 'adamsrazor_excerpt_length' );
function adamsrazor_continue_reading_link() {
return ' ' . __( 'Continue reading »', 'theme-adamsrazor' ) . '';
}
function adamsrazor_auto_excerpt_more( $more ) {
return ' …' . adamsrazor_continue_reading_link();
}
add_filter( 'excerpt_more', 'adamsrazor_auto_excerpt_more' );
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' );
function adamsrazor_remove_default_gallery_css ( $css ) {
return str_replace("border: 2px solid #cfcfcf;", "", $css);
}
add_filter('gallery_style', 'adamsrazor_remove_default_gallery_css' );
function adamsrazor_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Widget Area', 'theme-adamsrazor' ),
'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.', 'theme-adamsrazor' ),
'before_widget' => '
',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'theme-adamsrazor' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first (left) footer widget area', 'theme-adamsrazor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'theme-adamsrazor' ),
'id' => 'second-footer-widget-area',
'description' => __( 'The second (middle) footer widget area', 'theme-adamsrazor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'theme-adamsrazor' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third (right) footer widget area', 'theme-adamsrazor' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'adamsrazor_widgets_init' );
if ( ! function_exists( 'adamsrazor_post_meta_date' ) ) :
function adamsrazor_post_meta_date() {
printf( __( 'Published on %2$s by %3$s', 'theme-adamsrazor' ),
'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', 'theme-adamsrazor' ), get_the_author() ),
get_the_author()
)
);
}
endif;
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.', 'theme-adamsrazor' );
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in = __( 'This entry was posted in %1$s. Bookmark this page.', 'theme-adamsrazor' );
} else {
$posted_in = __( 'Bookmark this page.', 'theme-adamsrazor' );
}
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
endif;
// remove inline widths for images, but not other includes like YouTube vids
function adamsrazor_image_tag($html){
$html=preg_replace('/(\
]+)(height\=\"[^\"]+\")([^>]+)(>)/', '${1}${3}${4}', $html );
$html=preg_replace('/(\
]+)(width\=\"[^\"]+\")([^>]+)(>)/', '${1}${3}${4}', $html );
return $html;
}
add_filter('the_content','adamsrazor_image_tag',10,1);
// remove inline style from captions
// adapted from: http://troychaplin.ca/blog/wordpress-functions/remove-automatically-generated-inline-style-on-images-with-caption-in-wordpress/
add_shortcode('wp_caption', 'adamsrazor_fixed_img_caption_shortcode');
add_shortcode('caption', 'adamsrazor_fixed_img_caption_shortcode');
function adamsrazor_fixed_img_caption_shortcode($attr, $content = null) {
// Allow plugins/themes to override the default caption template.
$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;
$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 . '
';
}
if ( ! function_exists( 'adamsrazor_comment' ) ) :
function adamsrazor_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
id="li-comment-">