Support » Themes and Templates » What is wrong with this PHP code?

  • Resolved sabster

    (@sabster)


    i tried to follow the instructions this thread: http://wordpress.org/support/topic/how-do-i-change-width-of-twenty-ten-to-800-pixels?replies=7

    it was to change the size of the width of twentyten theme. i used the php given which was this:

    <?php
    
    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    if ( !function_exists( 'child_theme_setup' ) ):
    function child_theme_setup() {
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 800 ) );
    }

    and i get this error:

    Parse error: syntax error, unexpected 'define' (T_STRING), expecting '{' in C:\xampp\htdocs\wordpress\wp-content\themes\twentyten-child\functions.php on line 17

    this is what my functions.php looks like overall (it’s a child theme):

    <?php
    
    add_filter('twentyten_header_image_height','my_header_height');
    add_filter('twentyten_header_image_width','my_header_width');
    function my_header_height($size){
       return 180;
    }
    function my_header_width($size){
       return 1920;
    }
    
    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    if ( !function_exists( 'child_theme_setup' ) ) {
    function child_theme_setup()
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 822 ) );
    }

    there was another guy in the thread that said he also had an error and tried to give instructions on how to fix it, but it didnt work for me. can anyone help me with this?

Viewing 1 replies (of 1 total)
  • nevermind, fixed it. tis is how it should be if anyone searches for this:

    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    if ( !function_exists( 'child_theme_setup' ) ) {
    function child_theme_setup() {
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 822 ) ); }
    }

Viewing 1 replies (of 1 total)
  • The topic ‘What is wrong with this PHP code?’ is closed to new replies.