WordPress.org

Ready to get started?Download WordPress

Forums

datetime="%3$s" in raw text (3 posts)

  1. MultiformeIngegno
    Member
    Posted 2 years ago #

    Hello!
    I'm using a Twenty Ten child theme. I created a custom template and everything works properly except for the time of the posts.
    To display the time/date I use:
    <?php twentyten_posted_on(); ?>

    And the date is displayed, the problem is that looking at the code I have:
    <span class="sep">Published on</span> <time class="entry-date" datetime="%3$s" pubdate>20th december 2011</time> </div>

    Why there is datetime="%3$s" in raw text? For some strange reason it doesn't get converted...

    Can you help me?

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    look into functions.php of the theme; there might be an error in the code of the 'twentyten_posted_on' function.

    compare with a fresh download.

    what happens if you deactivate all plugins?

  3. MultiformeIngegno
    Member
    Posted 2 years ago #

    Ouch! You're right.
    I have this code (for overriding "Posted on" text and have it translated in italian):

    // function to override default posted on
    function twentyten_posted_on() {
    	$link= esc_url( get_permalink() );
    	$title= esc_attr( get_the_title() );
    	$time= esc_attr( get_the_time() );
    	$dateGMT= esc_attr( get_the_date( 'c' ) );
    	$date= esc_html( get_the_date() );
    	$authorURL= esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
    	$author= esc_html( get_the_author() );
    
    	echo ('<span class="sep">Pubblicato il</span> <time class="entry-date" datetime="%3$s" pubdate>'.$date.'</time>');
    
    }

    I just removed the datetime parameter and the problem is solved.

    Do you know another way to have the posted on text translated in italian instead of "hacking" the function?

    If I remove the function the text doesn't get translated.

Topic Closed

This topic has been closed to new replies.

About this Topic