Cannot activate Theme X due to cornerstone issue

Hello,
After copying the main website to a staging area we are having a strange issue.
Trying to activate theme - confirmation message appears and after reload the theme is not activated.
Deactivating/deleting cornerstone plugin makes it activate until we install cornerstone again.

Please check and advise on a solution.

Best Regards,
Nasko

Hi @kcreative,

Thanks for reaching out.

I just check your staging area and your X theme was activated but it is not validated. I went ahead and validate your staging then it went successfully without any problem.

Hope that helps.

Thank you.

Thank you. It seems to be working normally now.
There is another error.
All plugin updates wens smooth, including cornerstone.
But once I updated the theme to version 8, the critical error appeared/
Please check and assist.

Thank you.

Best Regsards,
Nasko

Hi Nasko,

Before updating your X theme to the latest version, I highly advise that you deactivate and delete your current cornerstone plugin to avoid any conflict then after that, you can now update your X theme to the latest version. Once you are done updating your X theme to the latest version, you can now install the cornerstone plugin.

Hope that helps.

Thank you.

I’ve did it as you said and it still gives fatal error.
Please take a look and advise a solution.

Best Regards,
Nasko

Hi Nasko,

I just check your website and I don’t see any fatal error. At the same time, your X theme and cornerstone plugin are already up to date. If you are still seeing the error on your end, please provide us a screenshots.

Hope that helps.

Thank you.

This is what I see even in incognito mode.

Best Regards,
Nasko

Hey Nasko,

I have logged in and switched your theme to the parent X theme. The homepage is now displaying properly. What does this mean? It means that a custom PHP code that you have added in your child theme’s function.php file is causing the issue. We highly recommend that you temporarily all the custom PHP code out of the child theme’s functions.php and put it back one by one. You’ll know which PHP code block is causing when the error returns.

It would also be helpful if you enable the debug mode. You can do this by opening wp-config.php and adding:


define('WP_DEBUG', true);

/* That's all, stop editing! Happy blogging. */

When you revisit your home page while the child theme is active, you should have some error output describing the issue in more detail.

Kindly let us know how it goes.

Thank you for the info, appreciate it!

It looks like the following functions breaks the php coode:

// =============================================================================
// Sets Custom Menu For WooCommerce Shop
// =============================================================================

add_filter( ‘wp_nav_menu_args’, ‘custom_blog_menu’ );

function custom_blog_menu( $args ) {
if ( x_is_product() || x_is_product_index() || x_is_shop()) {
$args[‘theme_location’] = ‘primary’;
$args[‘menu’] = ‘Shop Menu’;
}
return $args;
}

Is this a theme x function and has it been depreciated with the new update? Can we substitute it with a new one?

Thank you!

Hello Nasko,

The conditional functions of X theme have remained the same in the new version of the X theme. You may check in the file paththemes\x\framework\functions\frontend\conditionals.php

It might be the issue of your custom code. I would suggest you contact a developer who can assist you with your custom development. Please note that we don’t provide custom development support. It is out of the support scope.

Thanks for understanding

Thank you for the reply! The weird thing is that this was not giving an error until we updated Theme X and Cornerstone…

Hello @kcreative,

Your code in your child theme is custom:

// =============================================================================
// Sets Custom Menu For WooCommerce Shop
// =============================================================================

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
	if ( x_is_product() || x_is_product_index() || x_is_shop()) {
		$args['theme_location'] = 'primary';
		$args['menu'] = 'Shop Menu';
	}
	return $args;
}

This is not a theme function. It is a filter override.

Can you please send us the exact Fatal Error message in your error.log file? You may need to update the code above and remove x_is_product_index() from your code. Therefore, the updated code will only be:

// =============================================================================
// Sets Custom Menu For WooCommerce Shop
// =============================================================================

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
	if ( x_is_product() || x_is_shop()) {
		$args['theme_location'] = 'primary';
		$args['menu'] = 'Shop Menu';
	}
	return $args;
}

Thank you.

Thank you for the help, highly appreciate it! The updated code seems to be working fine!

The error with the old code was:

Your PHP code changes were rolled back due to an error on line 48 of file wp-content/themes/x-child/functions.php. Please fix and try saving again.

Uncaught Error: Call to undefined function x_is_product_index() in wp-content/themes/x-child/functions.php:48
Stack trace:
#0 wp-includes/class-wp-hook.php(287): custom_blog_menu(Array)
#1 wp-includes/plugin.php(212): WP_Hook->apply_filters(Array, Array)
#2 wp-includes/nav-menu-template.php(97): apply_filters(‘wp_nav_menu_arg…’, Array)
#3 wp-content/themes/x/framework/legacy/cranium/headers/functions/navbar.php(78): wp_nav_menu(Array)
#4 wp-content/themes/x/framework/legacy/cranium/headers/views/global/_nav-primary.php(19): x_output_primary_navigation()
#5 wp-content/themes/x/framework/functions/frontend/view-routing.php(180): include(’/home/c

Hello @kcreative,

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

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.