• I’ve modified my childthemes functions to ‘separate’ the default date stamp. With this code, all posts default to Jan 1, 1970. Please help fix my code! Thanks!

    function twentyeleven_posted_on() {
    	printf( __( '<span class="sep">Posted on </span>
    			   		<a href="%1$s" title="%2$s" rel="bookmark">
    
    						<span class="custommonth">%8$s</span><span class="customday">%9$s</span><span class="customyear">%10$s</span>
    			   		</a>
    			   <span class="by-author"> <span class="sep"> by </span> <span class="author vcard">
    			   <a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    		esc_html( get_the_author() ),
    		date("M", strtotime(get_the_date())),
    		date("j", strtotime(get_the_date())),
    		date("Y", strtotime(get_the_date()))
    	);
    }
    endif;
Viewing 1 replies (of 1 total)
  • Thread Starter js09

    (@js09)

    This looks like it fixed it (although I have no idea why)

    esc_attr( get_the_date( 'M' ) ),
    esc_attr( get_the_date( 'j' ) ),
    esc_attr( get_the_date( 'Y' ) )

    instead of:

    date("M", strtotime(get_the_date())),
    date("j", strtotime(get_the_date())),
    date("Y", strtotime(get_the_date()))
Viewing 1 replies (of 1 total)
  • The topic ‘new posts show up as Jan 1, 1970’ is closed to new replies.