Pro 1 to 2 (Take 2)

Hello Themeco,
We finally made a staging area where we can reproduce the problem originally posted here: https://theme.co/apex/forum/t/migrating-pro-1-to-pro-2/26922/9

You can reproduce the problem by simply updating Pro from 1 to 2.
We can’t grasp the reason it’s breaking the menus, but we can’t wait to find out so we can update all our websites with the newest version.

If you want us to try anything, please let us know or try it directly, it doesn’t matter what happens to that WordPress instance.

See secure note.

Kind regards,
Vince

Hi Vince,

Thanks for writing in!

I wanted to clone your staging site so that I can test it over in my local testing server. Regretfully I cannot activate any plugin in your site. Could you please update the Pro version to 2.0 instead? We will check and see what happens when it is using Pro 2.0. Hoping to find out what caused the issue where in the menus will break.

Please let us know how it goes.

Hello Rue,
I have updated the theme, you may login/look and you should see the menus’ style being distorted.

Thank you for your time, it’s very appreciated!

Hi there,

Thank you for the information. I went to Pro > Settings and clicked on the Clear Style Cache button. Then I cleared the WP Rocket cache and the OP Cache and now it seems that the front end of the website is working ok.

The need for the clicking of the Clear Style Cache is when you update the theme manually.

Thank you.

Hello Christopher,
Yeah, it seems like it works!

Where is the Style Cache stored? We’d like to automate the process for many websites (database? filesystem?).

Thank you, I guess we missed 1 or two cache types.

Hi there,

Thanks for writing in.

It’s in post meta table in database, the meta key is _cs_generated_styles.

Thanks!

Thank you Rad,
We use a WPMU, would it be safe to loop in every site and delete them directly?

Something like:
DELETE FROM wp_XX_post_meta WHERE meta_key = '_cs_generated_styles';

Hey @magikweb,

Yes, that will do. You could also add cornerstone_cleanup_generated_styles(); to functions.php of a child theme and remove it after making one request to the site.

Thanks.

Hello Christian,
Adding the call in functions.php causes a 500 error.
[29-Apr-2018 16:22:45 UTC] PHP Fatal error: Uncaught Error: Call to undefined function cornerstone_cleanup_generated_styles() in /home/magikwe1/public_html/wp-content/themes/pro-child/functions.php:75

Hi there,

How did you add it? You said you’d like to automate the process, so you must only call cornerstone_cleanup_generated_styles() or DELETE FROM wp_XX_post_meta WHERE meta_key = '_cs_generated_styles'; to the process you’re automating. Like Cron job or similar, it’s just an idea and you still need a complete code to do these. Remember that child theme is loaded first, hence that function isn’t available yet, so you must only call it through hooks (like add_action('init')) or any automated actions.

But if you’re in Cron job which can be a single PHP file where it’s not connected to Wordpress, then MySQL query is much more recommended since you must not load the entire Wordpress ecosystem just to automate the cleaning through Cron jobs.

Thanks!

Hello Rad,
We added it directly in the functions.php before sending a request to the website to trigger it.

Hi there,

You shouldn’t do that and that’s not what we meant. Please add it to your hooks or any automated code/process. You may wan’t to contact a developer to customize it further to make it automated. Those custom code should still be added to functions.php, but not just adding cornerstone_cleanup_generated_styles().

Thanks!

Alright, I thought that was a native function I could just call from Pro 1.

Should I expect a different behavior on a WPMU?
It worked when you cleared the style cache on the staging area (normal WP), but it doesn’t work on our end now it’s a subsite. In fact, the _cs_generated_styles doesn’t exist in its respective table (wp_44_postmeta).

If you wanna see what’s going on, you can use the info in the secure note. I’ll revert the changes a little later.

Hi there,

It’s a native function, but what I’m saying is you need to call it at the right time and right place (like automation). And not just calling it upon the functions.php.

Then please forget about the _cs_generated_styles and just call cornerstone_cleanup_generated_styles(). I’m not sure how your tables are named or what post you’re looking. But that function should clear them all. What I provided is just an idea as I initially thought that you have a way of automating the process :slight_smile:

It should work on multisite, the function cornerstone_cleanup_generated_styles() is just a shortcut for this

global $wpdb;
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_cs_generated_styles' ) );

The global $wpdb; hold the current database of the current site (that belongs to multi-site, or the single-site itself).

And you don’t have to create a MySQL query, but again, what was provided are just idea as I’m not sure of how you’ll automate it (my initial thought is Cron Job).

Thanks!

I understand, thank you very much for the clarification. Your idea is good, we’ll most likely create a button that does it through a plugin on-demand for all sites at the same time (Network Admin plugin).

Aside from the style caching, do you know of anything else that could affect the Header/Footer/Style in general?
All caches (that we know of) were emptied and the result is still different than expected.
https://www.magikweb.net/restaurantretro50-ca/

I double-checked the database for the meta_key and it was cleared successfully.

Hello There,

Since you are using SiteGround, could you please clear your site cache or disable the supercacher in your hosting panel? The SuperCacher is developed by SiteGround exclusively for their customers. It increases the number of hits a site can handle and boosts the website loading speed. The SuperCacher includes 4 different caching options for maximum optimization of your websites. You can access the tool by clicking on the SuperCacher icon in your cPanel.

For more information about this, please check it out here: https://www.siteground.com/tutorials/supercacher/supercacher_intro.htm

Hope this helps.

1 Like

No problem, I have just emptied all the caches and disable them entirely directly from the cPanel.

The header seems to be somewhat back, only its font is missing. I think Pro 2 forces font-family: Helvetica,Arial,sans-serif; by default, the content is fine. What would be the clean way to remove that font being used?

If it was like that before disabling the SuperCacher, could you tell us how you did it?

Thanks!

Hello There,

The font family is the current setting in your custom header.

You will need to edit your custom header (and footer) as well. Click the navigation inline element and find the text tab;

Hope this helps.

1 Like

Hello Rue,
Yes! That fixed it. The footer has the right parameter already (inherit) and its font is still incorrect, but we’ll look deeper.
The only choices were “Inherit”, “Body Copy” and “Heading”.

Thanks again!