WordPress.org

Ready to get started?Download WordPress

Forums

Editing functions.php breaks the site! (5 posts)

  1. FractalKitty
    Member
    Posted 1 year ago #

    I am working in Twenty Eleven child theme. I have added the fucntions.php and my first code tweak worked perfectly. But adding more code breaks the entire site. If I delete the file & retry, it works if I just add the first code tweak but if I include the second tweak, it breaks. I am new to this so I am not sure if I am doing anything wrong. Here is what I have so far:

    First tweak:
    <?php

    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1100 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 288 ) );
    ?>

    Second tweak:

    function twentyeleven_posted_on() {
    printf( __( '<span class="sep">Posted on </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time>', 'twentyeleven' ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    );
    }

    Here I am trying to remove the "Posted in" tag on all posts. I want to keep the date.

    I moved the php closing tag to the end of the code. What am I doing wrong? Any help would be much appreciated. Thank you!

  2. esoftload
    Member
    Posted 1 year ago #

    you have to use second code in between <?php and ?>.

  3. FractalKitty
    Member
    Posted 1 year ago #

    Tried that but its still breaking! :(

  4. FractalKitty
    Member
    Posted 1 year ago #

    I found out on another forum that there is an extra comma on the code. The code now doesnt break the site but I also don't see any changes. Here is the code:

    <?php

    function twentyeleven_posted_on() {
    printf( __( '<span class="sep">Posted on </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time>', 'twentyeleven' ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() )
    );
    }

    php?>

  5. FractalKitty
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic