WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to display Day of Week with get_the_date? (2 posts)

  1. deko
    Member
    Posted 1 year ago #

    I'm trying to modify a function in the Twenty Ten 1.3 theme. Below is the function (from lines 489 and following of /themes/twentyten/functions.php).

    What I'm trying to do is change esc_attr( get_the_time() ) so it returns the day of week (e.g. Wednesday).

    I can substitute get_the_date() for get_the_time() but how, in this context, do I apply the necessary filter to get the day of week? Everything I've tried just broke the function. Is it a matter of syntax or do I have to rework the function?

    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
    			get_the_author()
    		)
    	);
    }
  2. deko
    Member
    Posted 1 year ago #

    ugh. it may not look like it, but there's a lot of difference between 1 and l

    solution: esc_attr( get_the_date('l') )

Topic Closed

This topic has been closed to new replies.

About this Topic