Twenty Twelve Posted Function
-
Hello,
In the Twenty Eleven Theme, there was a function: twentyeleven_posted_on. Would anyone happen to know what the exact Twenty Twelve equivalent is?Thank you!
-
look for
twentytwelve_entry_meta()in fundtions.php of Twenty Twelveit might not be fully the exact equivalent.
Awesome! TY, Michael. I’ll give it a whirl.
Actually, I have already tried that, and it didn’t work for me. 🙁
It could also be that there is a conflict in some other part of the code I am using. It worked fine in Twenty Eleven, but something may not be jiving in Twenty Twelve. I may need to recreate the entire thing.
please describe what you are trying to achieve.
are you working with a child theme of Twenty Twelve right now?
what ‘twirl’ exactly have you tried?
Oh, I just had the meta information printing out a certain way for different categories.
Yes, I’m in the functions.php file of my Twenty Twelve Child Theme.
Michael,
This is what I used in my Twenty Eleven Child Theme:if ( ! function_exists( 'twentyeleven_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. * Create your own twentyeleven_posted_on to override in a child theme * * @since Twenty Eleven 1.0 */ function twentyeleven_posted_on() { if ( in_category( array('Political Cartoons', 'Political Statements' ) )) { // Custom: // Note: Remove (printf) code from between quotes, to make blank; otherwise: // If the category is one of the above, write out Post date (ONLY). printf( __( '<span class="sep">Posted </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></span>', 'twentyeleven' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); } elseif ( in_category( array('Scripture', 'Biblical', 'Biblical Resources', 'Quotes', 'Holidays/Anniversaries', 'Article', 'Political Literature', 'Political Terms') )) { // If the category is one of the above, use Posted by. printf( __( '<span class="sep">Posted by<span class="by-author"></span> <span class="author vcard"><a href="%5$s" title="%6$s" rel="author">%7$s</a></span><span class="sep"> | </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></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' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ), get_the_author() ); } else { // All other categories, use Written by printf( __( '<span class="sep">Written by<span class="by-author"></span> <span class="author vcard"><a href="%5$s" title="%6$s" rel="author">%7$s</a></span><span class="sep"> | Posted </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></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' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ), get_the_author() ); } } endif;Which I would like to replicate in Twenty Twelve.
My coding may not have been perfect, but it worked exactly how I wanted it to.
I think I might have solved it myself!
I replaced:
twentyeleven_posted_on
with
twentytwelve_entry_metaAnd, using Find and Replace, I changed every instance of twentyeleven, in the above code, to twentytwelve.
It appears to be working! 🙂 I may need to just do a tweak here and there.
Actually, that did not resolve it! 🙁
That only worked for the meta data on the Home Page. I am trying to get that above code – or the Twenty Twelve similar code – to work in the single.php file.
I think I know exactly what I need now, but I think I am going to start over with a new post.
The topic ‘Twenty Twelve Posted Function’ is closed to new replies.