<?php
function register_my_menu() {
	

	// Adds support for Navigation menu
	register_nav_menu( 'primary', __( 'Chocolate Menu', 'Chocolate' ) );
}
add_action( 'init', 'register_my_menu' );
function chocolate_content_nav( $html_id )
{
     global $wp_query;
     $html_id = esc_attr( $html_id );
     if ( $wp_query->max_num_pages > 1 ) : ?>
         <nav id="<?php echo $html_id; ?>" class="navigation" role="navigation">
             <h3 class="assistive-text"><?php _e( 'Post navigation', 'chocolate' ); ?></h3>
             <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'chocolate' ) ); ?></div>
             <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'chocolate' ) ); ?></div>
        </nav><!-- #<?php echo $html_id; ?> .navigation -->
     <?php endif;
}
// get loaded theme file name
function chocolate_comment( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	switch ( $comment->comment_type ) :
		case 'pingback' :
		case 'trackback' :
		// Display trackbacks differently than normal comments.
	?>
	<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
		<p><?php _e( 'Pingback:', 'chocolate' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'chocolate' ), '<span class="edit-link">', '</span>' ); ?></p>
	<?php
			break;
		default :
		// Proceed with normal comments.
		global $post;
	?>
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
		<article id="comment-<?php comment_ID(); ?>" class="comment">
			<header class="comment-meta comment-author vcard">
				<?php
					echo get_avatar( $comment, 30 );
					printf( '<cite class="fn">%1$s %2$s</cite>',
						get_comment_author_link(),
						// Adds Post Author to comments posted by the article writer
						( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Post author', 'chocolate' ) . '</span>' : ''
					);
					printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
						esc_url( get_comment_link( $comment->comment_ID ) ),
						get_comment_time( 'c' ),
						/* translators: 1: date */
						sprintf( __( '%1$s', 'chocolate' ), get_comment_date() )
					);
				?>
			</header><!-- .comment-meta -->

			<?php if ( '0' == $comment->comment_approved ) : ?>
				<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'chocolate' ); ?></p>
			<?php endif; ?>

			<section class="comment-content comment">
				<?php comment_text(); ?>
				<?php edit_comment_link( __( 'Edit', 'chocolate' ), '<p class="edit-link">', '</p>' ); ?>
			</section><!-- .comment-content -->

			<div class="reply">
				<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'chocolate' ), 'after' => ' <span>&darr;</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
			</div><!-- .reply -->
		</article><!-- #comment-## -->
	<?php
		break;
	endswitch; // end comment_type check
}
add_filter( 'avatar_defaults', 'new_default_avatar' );

function new_default_avatar ( $avatar_defaults ) {
		//Set the URL where the image file for your avatar is located
		$new_avatar_url = get_template_directory_uri() . '/img/bush.jpg';
		//Set the text that will appear to the right of your avatar in Settings>>Discussion
		$avatar_defaults[$new_avatar_url] = 'Tired Bush';
		//var_dump($avatar_defaults);
		return $avatar_defaults;
}
function chocolate_widgets_init() {
	register_sidebar( array(
		'name' => __( 'Main Sidebar', 'chocolate' ),
		'id' => 'sidebar-1',
		'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'chocolate' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );
}
add_action( 'widgets_init', 'chocolate_widgets_init' );
function chocolate_customize_register( $wp_customize ) {
	//All our sections, settings, and controls will be added here
	$colors = array();
	$colors[] = array(
		'slug'=>'content_text_color', 
		'default' => '#333',
		'label' => __('Content Text Color', 'Ari')
	);
	$colors[] = array(
		'slug'=>'content_link_color', 
		'default' => '#88C34B',
		'label' => __('Content Link Color', 'Ari')
	);
	foreach( $colors as $color )
	{
		// SETTINGS
		$wp_customize->add_setting(
			$color['slug'], array(
				'default' => $color['default'],
				'type' => 'option', 
				'capability' => 
				'edit_theme_options'
			)
		);
		// CONTROLS
		$wp_customize->add_control(
			new WP_Customize_Color_Control(
				$wp_customize,
				$color['slug'], 
				array('label' => $color['label'], 
				'section' => 'colors',
				'settings' => $color['slug'])
			)
		);
	}
}
add_action( 'customize_register', 'chocolate_customize_register' );
if ( ! isset( $content_width ) ) $content_width = 900;
add_theme_support( 'automatic-feed-links' );
add_theme_support( "post-thumbnails" );
?>