Support » Fixing WordPress » Twenty Twelve meta-data

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    In your child theme, you will need to place a copy of the theme functions template and make changes to the function twentytwelve_entry_meta(). Look for the following section of code:

    // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	if ( $tag_list ) {
    		$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} elseif ( $categories_list ) {
    		$utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} else {
    		$utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	}

    you will need to place a copy of the theme functions template

    never just copy the full content of functions.php of the parent theme into functions.php of the child theme – this will very likely lead to a fatal error.

    only ever add pluggable functions to a new functions.php in the child theme, or any functions to overwrite stuff from the parent theme.

    http://codex.wordpress.org/Child_Themes#Using_functions.php

    Thanks for that tip alchymyth! I completely took that for granted.

    Hi PATWIST,

    I came to help like you asked, but I think mar1965 and alchmyth have it under control. Good luck with your website!

    Thread Starter patwist

    (@patwist)

    Sorry I’m confused now. So what do I do?

    I have created empty functions.php in child theme

    if ( ! function_exists( 'twentytwelve_entry_meta()' ) ) {
        function theme_special_nav() {
            //  What request i can place here?
        }
    }

    Hi,

    This requires some changes to the php code. If you are comfortable doing so, here are some steps you can follow:

    1. Copy the original php code of function twentytwelve_entry_meta() into your empty child theme’s functions.php template.

    2. In the template file in your child theme just modified in number 1 above, insert the following line of code:

    if ( ! function_exists( 'twentytwelve_entry_meta()' ) ) {

    between the opening <?php tag and the line that says:

    function twentytwelve_entry_meta() {

    It should then look like this:

    <?php
    
    if ( ! function_exists( 'twentytwelve_entry_meta()' ) ) {
    
    function twentytwelve_entry_meta() {

    3. In the function program code, look for the section:

    // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	if ( $tag_list ) {
    		$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} elseif ( $categories_list ) {
    		$utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} else {
    		$utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	}

    and make these changes:

    // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	if ( $tag_list ) {
    		$utility_text = __( '<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} elseif ( $categories_list ) {
    		$utility_text = __( '<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	} else {
    		$utility_text = __( '<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
    	}

    4. Last, and extremely important, add another } (a closing bracket) just above the ?> (closing php tag at the bottom).

    never just copy the full content of functions.php of the parent theme into functions.php of the child theme – this will very likely lead to a fatal error.
    only ever add pluggable functions to a new functions.php in the child theme, or any functions to overwrite stuff from the parent theme.

    Thank you, alchymth thank you. Kept wondering why my child theme was not working.
    Off to RTM about pluggable functions.

    Is the above code from Mar1965 working for others?

    I have a functions.php in a child theme, with one new function in it.
    I copied the entire function twentytwelve_entry_meta() code from the parent into it.
    At this point, the site still works fine.
    Then I made the changes above, and it broke my site (‘no data received’). The only differences I can see are that
    1) there is no php closing tag in my parent functions.php (but I’ve tried it with and without the closing tag); and
    2) the child functions.php contains another function.

    Is there another step that was left out?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Twenty Twelve meta-data’ is closed to new replies.