WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Twelve meta-data (9 posts)

  1. PATWIST
    Member
    Posted 1 year ago #

    Hello, I want to delete the text "This entry was added to" and day
    There is edited snaphsot how it should look: http://i49.tinypic.com/1zv6hcy.png
    http://live-kamery.patwist.com/category/staty/slovensko/dediny/cerveny-klastor/

  2. mar1965
    Member
    Posted 1 year ago #

    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' );
    	}
  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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

  4. mar1965
    Member
    Posted 1 year ago #

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

  5. Odai Athamneh
    Member
    Posted 1 year ago #

    Hi PATWIST,

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

  6. PATWIST
    Member
    Posted 1 year ago #

    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?
        }
    }
  7. mar1965
    Member
    Posted 1 year ago #

    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).

  8. greggviro
    Member
    Posted 1 year ago #

    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.

  9. david.danaan
    Member
    Posted 7 months ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic