• Resolved markross67

    (@markross67)


    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!

Viewing 11 replies - 1 through 11 (of 11 total)
  • look for twentytwelve_entry_meta() in fundtions.php of Twenty Twelve

    it might not be fully the exact equivalent.

    Thread Starter markross67

    (@markross67)

    Awesome! TY, Michael. I’ll give it a whirl.

    Thread Starter markross67

    (@markross67)

    Actually, I have already tried that, and it didn’t work for me. ??

    Thread Starter markross67

    (@markross67)

    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?

    Thread Starter markross67

    (@markross67)

    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.

    Thread Starter markross67

    (@markross67)

    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.

    Thread Starter markross67

    (@markross67)

    My coding may not have been perfect, but it worked exactly how I wanted it to.

    Thread Starter markross67

    (@markross67)

    I think I might have solved it myself!

    I replaced:
    twentyeleven_posted_on
    with
    twentytwelve_entry_meta

    And, 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.

    Thread Starter markross67

    (@markross67)

    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.

    Thread Starter markross67

    (@markross67)

    I think I know exactly what I need now, but I think I am going to start over with a new post.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Twenty Twelve Posted Function’ is closed to new replies.