PHP Parse error: syntax error, unexpected

Website doesn’t pop up This page isn’t working
www.serioustakeproductions.com is currently unable to handle this request. HTTP Error 500

The exact error is
PHP Parse error: syntax error, unexpected ‘<’ in /home8/seriovd2/public_html/wp-content/themes/x/functions.php on line 118"

I was trying to place a google analytics code on the header and when i placed it, I got this issue. Could you just erase the line 118 to resolve the issue ASAP please?

I’d be happy to provide this info:

FTP Host
FTP username
FTP password

Thank you,
Danielle

Hey there,

Thanks for writing in. Sorry but please remove the additional code you placed in functions.php. That is not the correct setup and you’re also not using a child theme.

We have a Google Analytics extension you can use to avoid this issue of having syntax errors in PHP. Please see https://theme.co/apex/forum/t/extension-google-analytics/84

If you want to put additional functions to your site thru functions.php and other template files, you’ll need to use a child theme so future updates won’t wipe out your customizations. Please see https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57

Also see the customization best practices at https://theme.co/apex/forum/t/customizations-best-practices/205

Thanks.

Xian, unfortunately, I’m locked out of the admin site too. I do not have access to fixing this. My website is down completely.

If I contacted Bluehost to change this theme to child theme, will I lose all of the page content? If so, is there any work around on your side? I’d like to keep all of my page contents.

Would appreciate your help.

Hey @Serious_Take_Product,

No you will not lose any page contents if you switch to child theme. At present I am unable to connect to FTP using given credentials. You can access WordPress dashboard if you activate default theme.

To activate default theme browse to wp-content/themes using FTP, You will see the list of themes if installed. Just rename X theme to something else. Now you will be able to login to your wp-admin dashboard.

You can activate any other theme for time being and remove the code that caused issue from your functions.php file in X theme(You can rename back to X after activating default theme). Upload X child theme and activate it.

Hope this helps

Regards

@rahul I do not understand where to go? Would I sign into BlueHost and click FTP, then what? Or do I need to use something like CyberDuck for Mac then browse to wp-content/themes?

Hey @Serious_Take_Product,

Yes once default theme is set, You will be able to access WordPress admin. If you are on linux hosting then you can have access to file manager in CPanel. If not then use CyberDuck for mac you can file website files in public_html folder.

If your hosting provider can help you to set default theme then you will be able remove code from functions.php file using WordPress editor.

You can edit files from Appearance >> Editor. Select X theme from drop-down and modify functions.php, Always use child theme for any kind of modifications.

If you are not sure how your modifications are going to reflect just test modifications on staging website first and then move modifications to live website :slight_smile:

Regards

@rahul …So, I’ve done that I have received this fatal error on both Child Theme and X-Theme. I deleted the Google Analytics code from functions.php

Fatal error: Uncaught Error: Call to undefined function x_get_view() in /home8/seriovd2/public_html/wp-content/themes/x/page.php:17 Stack trace: #0 /home8/seriovd2/public_html/wp-includes/template-loader.php(74): include() #1 /home8/seriovd2/public_html/wp-blog-header.php(19): require_once(’/home8/seriovd2…’) #2 /home8/seriovd2/public_html/index.php(17): require(’/home8/seriovd2…’) #3 {main} thrown in /home8/seriovd2/public_html/wp-content/themes/x/page.php on line 17

Hey @Serious_Take_Product,

Is there any other modifications you have applied?
Take a look at the code in line number 118 in functions.php, Is there any extra unexpected ‘<’ symbol around this lines?

Regards

I shared my FileZilla information in Secure Note above. Are you able to check to see if the coding is correct in functions.php please?

What should the functions.php line look like?

I found the Google Analytics code: at the end of the line in FileZilla in functions.php for X theme. I erased it… still same code error.

This is what I have in the Functions.php folder for X Theme (Found in FileZilla)

<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Theme functions for X. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Define Path / URL Constants // 02. Set Paths // 03. Preboot // 04. Set Asset Revision Constant // 05. Require Files // ============================================================================= function x_boot() { // Define Path / URL Constants // --------------------------- define( 'X_TEMPLATE_PATH', get_template_directory() ); define( 'X_TEMPLATE_URL', get_template_directory_uri() ); // Set Paths // --------- $load_path = X_TEMPLATE_PATH . '/framework/load'; $func_path = X_TEMPLATE_PATH . '/framework/functions'; $glob_path = X_TEMPLATE_PATH . '/framework/functions/global'; $admn_path = X_TEMPLATE_PATH . '/framework/functions/global/admin'; $lgcy_path = X_TEMPLATE_PATH . '/framework/legacy'; $eque_path = X_TEMPLATE_PATH . '/framework/functions/global/enqueue'; $plgn_path = X_TEMPLATE_PATH . '/framework/functions/global/plugins'; // Preboot // ------- $x_boot_files = glob( "$load_path/*.php" ); sort( $x_boot_files ); foreach ( $x_boot_files as $filename ) { $file = basename( $filename, '.php' ); if ( file_exists( $filename ) && apply_filters( "x_pre_boot_$file", '__return_true' ) ) { require_once( $filename ); } } // Set Asset Revision Constant (For Cache Busting) // ----------------------------------------------- define( 'X_ASSET_REV', X_VERSION ); // Require Files // ------------- $require_files = apply_filters( 'x_boot_files', array( $glob_path . '/debug.php', $glob_path . '/conditionals.php', $glob_path . '/helpers.php', $glob_path . '/stack-data.php', $glob_path . '/tco-setup.php', $admn_path . '/thumbnails/setup.php', $admn_path . '/setup.php', $admn_path . '/meta/setup.php', $admn_path . '/sidebars.php', $admn_path . '/widgets.php', $admn_path . '/custom-post-types.php', $admn_path . '/cs-options/setup.php', $admn_path . '/customizer/setup.php', $admn_path . '/addons/setup.php', $lgcy_path . '/setup.php', $eque_path . '/styles.php', $eque_path . '/scripts.php', $glob_path . '/class-view-routing.php', $glob_path . '/class-action-defer.php', $glob_path . '/meta.php', $glob_path . '/featured.php', $glob_path . '/pagination.php', $glob_path . '/breadcrumbs.php', $glob_path . '/classes.php', $glob_path . '/portfolio.php', $glob_path . '/social.php', $glob_path . '/content.php', $glob_path . '/remove.php', $func_path . '/integrity.php', $func_path . '/renew.php', $func_path . '/icon.php', $func_path . '/ethos.php', $plgn_path . '/setup.php' )); foreach ( $require_files as $filename ) { if ( file_exists( $filename ) ) { require_once( $filename ); } } } x_boot();

Hi There @Serious_Take_Product

It seems that you have resolved your issue. In case if you need the original functions.php file, copy from the following code.

<?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Theme functions for X.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Define Path / URL Constants
//   02. Set Paths
//   03. Preboot
//   04. Set Asset Revision Constant
//   05. Require Files
// =============================================================================

function x_boot() {

  // Define Path / URL Constants
  // ---------------------------

  define( 'X_TEMPLATE_PATH', get_template_directory() );
  define( 'X_TEMPLATE_URL', get_template_directory_uri() );


  // Set Paths
  // ---------

  $load_path = X_TEMPLATE_PATH . '/framework/load';
  $func_path = X_TEMPLATE_PATH . '/framework/functions';
  $glob_path = X_TEMPLATE_PATH . '/framework/functions/global';
  $admn_path = X_TEMPLATE_PATH . '/framework/functions/global/admin';
  $lgcy_path = X_TEMPLATE_PATH . '/framework/legacy';
  $eque_path = X_TEMPLATE_PATH . '/framework/functions/global/enqueue';
  $plgn_path = X_TEMPLATE_PATH . '/framework/functions/global/plugins';


  // Preboot
  // -------

  $x_boot_files = glob( "$load_path/*.php" );

  sort( $x_boot_files );

  foreach ( $x_boot_files as $filename ) {
    $file = basename( $filename, '.php' );
    if ( file_exists( $filename ) && apply_filters( "x_pre_boot_$file", '__return_true' ) ) {
      require_once( $filename );
    }
  }


  // Set Asset Revision Constant (For Cache Busting)
  // -----------------------------------------------

  define( 'X_ASSET_REV', X_VERSION );


  // Require Files
  // -------------

  $require_files = apply_filters( 'x_boot_files', array(

    $glob_path . '/debug.php',
    $glob_path . '/conditionals.php',
    $glob_path . '/helpers.php',
    $glob_path . '/stack-data.php',
    $glob_path . '/tco-setup.php',

    $admn_path . '/thumbnails/setup.php',
    $admn_path . '/setup.php',
    $admn_path . '/meta/setup.php',
    $admn_path . '/sidebars.php',
    $admn_path . '/widgets.php',
    $admn_path . '/custom-post-types.php',
    $admn_path . '/cs-options/setup.php',
    $admn_path . '/customizer/setup.php',
    $admn_path . '/addons/setup.php',

    $lgcy_path . '/setup.php',

    $eque_path . '/styles.php',
    $eque_path . '/scripts.php',

    $glob_path . '/class-view-routing.php',
    $glob_path . '/class-action-defer.php',
    $glob_path . '/meta.php',
    $glob_path . '/featured.php',
    $glob_path . '/pagination.php',
    $glob_path . '/breadcrumbs.php',
    $glob_path . '/classes.php',
    $glob_path . '/portfolio.php',
    $glob_path . '/social.php',
    $glob_path . '/content.php',
    $glob_path . '/remove.php',

    $func_path . '/integrity.php',
    $func_path . '/renew.php',
    $func_path . '/icon.php',
    $func_path . '/ethos.php',

    $plgn_path . '/setup.php'

  ));

  foreach ( $require_files as $filename ) {
    if ( file_exists( $filename ) ) {
      require_once( $filename );
    }
  }

}

x_boot();

Thanks!

Sir, this has not solved my issue. I got this error when activating X Theme or Child Theme as previously stated above last night:

Fatal error: Uncaught Error: Call to undefined function x_get_view() in /home8/seriovd2/public_html/wp-content/themes/X Theme/page.php:17 Stack trace: #0 /home8/seriovd2/public_html/wp-includes/template-loader.php(74): include() #1 /home8/seriovd2/public_html/wp-blog-header.php(19): require_once(’/home8/seriovd2…’) #2 /home8/seriovd2/public_html/index.php(17): require(’/home8/seriovd2…’) #3 {main} thrown in /home8/seriovd2/public_html/wp-content/themes/X Theme/page.php on line 17

And now for some reason, I see this in the wordpress dashboard:

Broken Themes

The following themes are installed but incomplete.

Name Description
X – Child Theme The parent theme is missing. Please install the “x” parent theme.

And for some reason after receiving this message I’m getting a different error when I try to activate the X Theme, I get this:

Warning: require(/home8/seriovd2/public_html/wp-content/themes/X Theme/inc/custom-header.php): failed to open stream: No such file or directory in /home8/seriovd2/public_html/wp-content/themes/X Theme/functions.php on line 503

Warning: require(/home8/seriovd2/public_html/wp-content/themes/X Theme/inc/custom-header.php): failed to open stream: No such file or directory in /home8/seriovd2/public_html/wp-content/themes/X Theme/functions.php on line 503

Fatal error: require(): Failed opening required ‘/home8/seriovd2/public_html/wp-content/themes/X Theme/inc/custom-header.php’ (include_path=’.:/opt/php70/lib/php’) in /home8/seriovd2/public_html/wp-content/themes/X Theme/functions.php on line 503

Hello There,

Thanks for updating in! To make sure that there are no files being corrupted, I have re installed X and Cornerstone. I even updated it to the latest version. You should no longer be seeing any errors in your dashboard now.

To avoid any error, please insert your GA code in the designated areas. I can see that you already have installed Google Analytics extension. Please enable it by going to X > Google Analytics and insert the GA code.

After making all your site change like the adding of GA code, since you are using CloudFlare, please login to your CloudFlare account and purger everything. This will make sure that the latest codes and changes is used and not the cache version store in CloudFlare is displayed.

If you need anything else we can help you with, don’t hesitate to open another thread.

Hi There,

I was able to revive your parent XTheme and child theme. Here’s what I did for your reference.

I did login to your server via FTP and checked the themes folder, first issue I saw is you renamed the parent x folder to X THEME, that is wrong the x-child theme will never identify its parent if you renamed the x folder other than x.

Then I check the parent X|Theme functions.php file and I am surprise that it is the functions.php file of Twenty Fourteen theme, so most likely you overwrite the original functions.php of the parent X Theme, causing a barrage of error to your site. I did restore the original functions.php file of XTheme by downloading a fresh copy of X and uploading just the functions.php file to your site. After doing this I was able to activate the parent and child theme without error.

But I notice the huge space between header and body, so investigated it and see the code below that is causing the issue, that css code is place on the top of Theme Options > CSS, I did commented it out.

.site > .x-container.max.width {
    margin-top: 110px !important;
}

I advice that you update your parent X theme to 5.1.1 now, because we never know what other files (besides functions.php) that you modified or accidentally overwrite on the parent x theme without knowing. Updating the theme will wipe out all those modifications and what not.

The x-child theme is there for you to do modification that will not overwritten when the parent x theme update. I also check your child theme and it seems new and all good :slight_smile:

You can add your Google Analytics code under X > Google Analytics. That is an extension that is comes with the X Theme. I did already install it.

P.S. Maybe you’re wondering why there are 2 replies on your ticket, its me who’s working on your site first. But Rue wrote reply first :sweat_smile:

Hope this helps,
Cheers!

@friech, thank you SO much! It is almost back to normal. :grinning:

This may be a silly question…can you walk me through the steps on how to update my parent X them to 5.1.1 before I accidentally mess something else up?

Best!
Danielle

Hi There,

Glad to hear that, you can follow the Updating Your Themes and Plugins guide. (see the Automatic Updates section)

But Ruenel already updated your X theme to 5.1.1 :slight_smile:

Cheers!

Oh perfect then, I do not need to worry about that. Thank you both! :grinning:

You are most welcome. :slight_smile:

@friech, you have been very helpful.

I know that some of the code was overwritten but, I’m wondering why 3 of the tabs do not fit the full screen but, the others do on Desktop? The homepage, the career page, and meet the team page have all of the content shifted towards the left whereas the rest of the pages fit the full screen on the desktop and laptop. Is this something that can be fixed in the code?

See this link for example: http://www.serioustakeproductions.com/video-production-company-los-angeles/

versus this page that is normal:

http://www.serioustakeproductions.com/services/

Hi There,

This page http://www.serioustakeproductions.com/services/ is using a Blank - No Container | Header, Footer template, this means that this page does not have a sidebar and containers so its section can go full-width.

While the Home, Careers, and Meet the Team page are using the Default Template this template does have a sidebar and container.

Notice your content is inside a white box? that is the container. And notice the empty space on the right of those pages? That is the sidebar.

Your issue here is your sidebar is empty. If you have content on your sidebar before chances are it was being wipe out when you switch to default theme. Wordpress do this because themes has different set of sidebars.

If you’re lucky you can see your old sidebar widgets on the Inactive list, you can drag it back to there respective sidebars. If not, then you need to rebuild your sidebars.

Or if you dont want a sidebar on your pages, just set them to use the Blank - No Container | Header, Footer template.

Hope this shed some lights,
Cheers!