Support » Fixing WordPress » Child functions.php not overwriting parent

  • Resolved Big Hungry Geek


    Trying to modify the twentyeleven_posted_on() function using a child theme. Searched through a dozen identical topics and followed a myriad of tips to no avail, so I’m sorry if I’m being super redundant.

    Steps taken:

    1. Created a new directory called /wp-content/themes/twentyeleven-child
    2. Uploaded a blank style.css to /twentyeleven-child
    3. Uploaded a blank functions.php to /twentyeleven-child
    4. Added required header & import information to the new style.css
    5. Copied entire twentyeleven_posted_on() function into the new functions.php, changing only “Posted on” to “Published on” just to test it out, but my site still displays “Posted on.”

    Entire contents of /twentyeleven-child/style.css

    Theme Name: Twenty Eleven Child
    Author: Big Hungry Geek
    Author URI:
    Description: Child theme for the twenty eleven theme.
    Version: 1.0
    License: GNU General Public License v2 or later
    License URI:
    Template: twentyeleven
    @import url("../twentyeleven/style.css");
    @import url("../twentyeleven/editor-style-rtl.css");
    @import url("../twentyeleven/editor-style.css");
    @import url("../twentyeleven/rtl.css");

    Entire contents of /twentyeleven-child/functions.php

    function twentyeleven_posted_on() {
    	printf( __( '<span class="sep">Published on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></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() ) ),

    I copied the function exactly from the parent to the child, and I only changed “Posted on” to “Published on,” but my site still displays “Posted on.” Am I overlooking something that should be obvious that’s preventing the child function from properly overwriting the parent? I know this function in the parent has if ( ! function_exists( 'twentyeleven_posted_on' ) ) :, so I should be OK? Any help would be very much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Child functions.php not overwriting parent’ is closed to new replies.