I would like some help with this. I would like to change the date format to numbers in my wordpress theme. Currently its set February 5, 2014 to but I would like it to be like 02-05-14. I am not a php coder but I think it has something to do with the sprintf function that I copied from functions.php. The code below is from my functions.php file in my child theme.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
<div class="featured-post">
<?php _e( 'Featured post', 'twentytwelve' ); ?>
</div>
<?php endif; ?>
<header class="entry-header">
<?php if ( is_search() || is_archive () || is_category () || is_tag () || is_home() ) : // Only display Excerpts for Search ?>
<?php //if ( !(is_search() || is_archive() || is_category() || is_tag() || is_home()) ) : // Only display Excerpts for Search ?>
<?php //the_post_thumbnail(); ?>
<?php //endif; ?>
<?php if ( is_single() ) : ?>
<h1 class="entry-title post-title"><?php the_title(); ?></h1>
<?php else : ?>
<?php endif; // is_single() ?>
<?php if ( comments_open() ) : ?>
<!--<div class="comments-link">
<?php // comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
</div>--><!-- .comments-link -->
<?php endif; // comments_open() ?>
<footer class="entry-meta post-content">
<?php if ( has_post_thumbnail() ) :
echo '<figure class="cat-thumb">';
the_post_thumbnail('category-thumb');
echo '</figure>';
endif;
?>
<?php if ( has_post_thumbnail() ) {
echo '<div id="blogPostContent">'; }?>
<p class="post-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></p>
<div class="entry-summary">
<div class="postByLine">
<?php
$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),
get_the_author()
);
echo ' Published on ' . $date . ' | By ' . $author . ' | ';
if ( comments_open() ) : ?>
<?php comments_popup_link( '<span class="leave-reply">' . __( 'No Comments', 'twentytwelve' ) . '</span>', __( '1 Comment', 'twentytwelve' ), __( '% Comments', 'twentytwelve' ) ); ?>
<?php endif; // comments_open()
?>
</div>
<?php the_excerpt(); ?><span class="read_more"><a href="<?php the_permalink(); ?>">Read More</a></span>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
<?php if ( has_post_thumbnail() ) {
echo '</div>'; } ?> <!-- end post content div -->
</footer>
</header><!-- .entry-header -->
<footer class="entry-meta">
<? // php twentytwelve_entry_meta(); ?>
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
<div class="author-info">
<div class="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>
</div><!-- .author-avatar -->
<div class="author-description">
<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
<p><?php the_author_meta( 'description' ); ?></p>
<div class="author-link">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
<?php printf( __( 'View all posts by %s <span class="meta-nav">→</span>', 'twentytwelve' ), get_the_author() ); ?>
</a>
</div><!-- .author-link -->
</div><!-- .author-description -->
</div><!-- .author-info -->
<?php endif; ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
Dashboard > Settings > General
You can then choose the format you prefer:
m-d-y
Try this..
you can set your date formate from wp-admin settings>. General under date format.. change according to the date format check the image below
add m-d-Y on the custom filed to do it.