-3

Hi I ran into a prob while setting up the functions.php file for Wordpress. My localhost server is showing this error: Parse error: syntax error, unexpected 'if' (T_IF) in /Applications/MAMP/htdocs/wdnomads-wp/wp-content/themes/womendigitalnomads/functions.php on line 3

I've tried googling and pasting Wordpress' own code, but the error still exists. Not sure what I'm doing wrong.

<? php

    if ( ! isset( $content_width ) ) {
    $content_width = 660;
}
xtjnrchris
  • 45
  • 1
  • 8

3 Answers3

2

What exactly is your question?

Your formatting should have no space before php

1

<? php should be <?php.

OneOfOne
  • 95,033
  • 20
  • 184
  • 185
  • Thanks that worked, but now it shows I have an error with another line of code: Parse error: syntax error, unexpected ')' I've tried looking for an extra ' but can't find it. Can you help? Thank you! wp_enqueue_script( 'bootstrapjs', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), true ); } add_action('wp_enqueue_scripts'; 'womendig_scripts'); – xtjnrchris Apr 30 '16 at 19:34
0

Try out this, just replace your code with following code :-

function prefix_content_width() {
    $GLOBALS['content_width'] = apply_filters( 'prefix_content_width', 660 );
}
add_action( 'after_setup_theme', 'prefix_content_width', 0 );
Anup GC
  • 742
  • 1
  • 6
  • 16