Saltar navegación

[Resuelto] Getting error when Toolset is enabled

This support ticket is created hace 3 años, 2 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por MargeP6083 hace 3 años, 2 meses.

Asistido por: Nigel.

Autor
Mensajes
#2202257

I am trying to get rid of this notice:

Notice: A non well formed numeric value encountered in /home/customer/www/xxxxxxxx.com/public_html/wp-content/themes/generatepress/inc/css-output.php on line 752

Found on this page: enlace oculto

Steps I took:
1. I contacted GeneratePress.
2. Deactivated everything except GP and Woocommerce plugins and no error.
3. Activated all nonToolset plugins, no error.
4. Acivated Toolset plugins, error returned.
5. I tried changing page template and making the page with wider. Same error.

I don't know what else to try.

I have provided access to a staging site. You are welcome to deactivate plugins if you want.
Thanks!

#2202391

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Marge

I downloaded a copy of the site so that I could investigate more easily.

Interestingly, the issue only occurs with the GeneratePress child theme active, not with the parent theme, although it is not obvious why.

Anyway, I didn't dwell too long on exactly what is required to reproduce the PHP notice, because it is clearly the result of a flaw in the GeneratePress theme code.

If you want to share details with them, the PHP notice is

PHP Notice:  A non well formed numeric value encountered in /Users/nigelanderson/OnTheGo/Sites/c-marge/wp-content/themes/generatepress/inc/css-output.php on line 752

The offending line of code (line 752 in the above mentioned file) is:

$css->add_property( 'max-width', generate_get_option( 'container_width' ) + $content_padding, false, 'px' );

Note that it is trying to add an option value (for container width) to a variable $content_padding.

$content_padding is a number.

But generate_get_option( 'container_width' ) is not a number. On your site it is "1200px", which is a string.

You can modify the theme container_width option in the Layouts tab of Customizer, and seemingly it stores the option in a format that includes the px units, rather than simply as a number.

That's the root cause of the problem, even though I haven't looked at what in Blocks prompts that theme code to be run.

#2202403

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Actually, hold on a moment Marge, as when I check the actual entry in wp_options for the generate_settings options it looks like it *is* stored just as a number, even though when querying the option it is being returned with a 'px' suffix.

Let me dig a little deeper there.

#2202405

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Screenshot 2021-10-22 at 10.05.00.png

Actually, we have the theme options settings with GeneratePress where you can override the theme settings, and the problem is there.

Specifically, on the custom product archive in the theme options, you have included px in the width where it should just be a number (e.g. 1200).

I made that change on your staging site and the PHP notice disappeared, you'll need to do the same on your production site.

#2202999

Thanks for catching that! My issue is resolved now. Thank you!