WordPress.org

Support

Support » Themes and Templates » Code removal–crash vs. no crash

Code removal–crash vs. no crash

  • I have removed/added many pieces of code to my website (answeringproblem.com), and it obviously made the right changes. When i removed the following code from theme fuctions in the 2010 wordpress theme, it crashed my site; why?

    if ( ! function_exists( 'twentyten_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     *
     * @since Twenty Ten 1.0
     */
    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
    			get_the_author()
    		)
    	);
    }

    Thanks for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Because that function is being used somewhere else in the theme (or in that case, in many, many other places), and when WP tries to execute the function, it discovers that it’s not there.

    If you’re trying to remove or change the output, change what the function is doing (preferably in a child theme) rather than just deleting it outright. Otherwise, you’d have to delete all the calls to that function in all your templates (again, preferably in a child theme).

    Thanks. I want to remove “Posted on June 25, 2012 by Nathan George” when I get a search result. Do you know how to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code removal–crash vs. no crash’ is closed to new replies.