__( 'Sidebar', 'brendah' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'brendah' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'brendah_widgets_init' );
/**
* Enqueues scripts and styles.
*
* @since Brendah 1.0
*/
function brendah_scripts() {
// Theme stylesheet.
wp_enqueue_style( 'brendah-style', get_template_directory_uri() . '/style.css' );
// Load the html5 shiv.
wp_enqueue_script( 'brendah-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3' );
wp_script_add_data( 'brendah-html5', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'brendah-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20160816', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'brendah_scripts' );
if ( ! function_exists( 'brendah_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
*/
function brendah_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
the_title_attribute( 'echo=0' ) ) ); ?>
%1$s%2$s %4$s',
get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ),
_x( 'Author', 'Used before post author name.', 'brendah' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
}
//The date
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
brendah_entry_date();
}
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo ' | ';
}
}
endif;
if ( ! function_exists( 'brendah_entry_date' ) ) :
/**
* Prints HTML with date information for current post.
*
* Create your own brendah_entry_date() function to override in a child theme.
*
* @since Brendah 1.0
*/
function brendah_entry_date() {
$time_string = '';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
get_the_date(),
esc_attr( get_the_modified_date( 'c' ) ),
get_the_modified_date()
);
printf( ' | %1$s %3$s',
_x( 'Posted on', 'Used before publish date.', 'brendah' ),
esc_url( get_permalink() ),
$time_string
);
}
endif;
/**
* Adds custom classes to the array of body classes.
*
*/
function brendah_body_classes( $classes ) {
// Adds a class of no-sidebar to sites without active sidebar or the chosen sidebar position.
if ( ! is_active_sidebar( 'sidebar-1' )) {
$classes[] = 'no-sidebar';
} else {
$classes[] = get_theme_mod( 'sidebar', 'right-sidebar' );
}
return $classes;
}
add_filter( 'body_class', 'brendah_body_classes' );
/**
* Add woocommerce support
*
*/
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper',10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end',10);
add_action('woocommerce_before_main_content', 'brendah_woocommerce_output_content_wrapper', 10);
add_action('woocommerce_after_main_content', 'brendah_woocommerce_output_content_wrapper_end', 10);
function brendah_woocommerce_output_content_wrapper() {
?>