Hi,
The CAPTCHA is set to only call the styling when the shortcode is called to help make your site faster on pages not using the CAPTCHA, I’m sure why it would not display the styling.
Are you using any caching plugins?
Could you share a link to your site?
Thanks
Thank you for your repy.
For the cache’m using WP rocket, i already tried to clear all the cache of my website.
Link for my website :
https://www.valeuriad.fr/
Then go to contact with menu.
When i call directly the page contact, the captcha style is loaded:
https://www.valeuriad.fr/contact
Thanks again for your support
That is very strange behavior, I use WP Rocket myself and I have never seen that issue before. What settings do you have enabled under WP Rocket->File Optimization->CSS Files?
Do you have any page-specific WP Rocket settings set?
Considering the issue only occurs when going from the home page to the contact page via the menu, it most likely has nothing to do with WP Rocket.
I see that the page does not reload, so I’m guessing you are using ajax or the rest API to call the page and you are just updating the URL?
Is this a function built into a premium theme/plugin or is it something you built yourself?
Yes i’m using the rest API to call the page, it’s a homemade solution for having single page web application.
So it appears that calling the content rendered in the rest API does not trigger the wp_enqueue_style( 'cf7ic_style' ); function inside the shortcode, which makes sense.
I would like to continue to enqueue the stylesheet from within the CAPTCHA shortcode as its considered best practice and it helps to remove additional HTTP requests for those without a speed optimization plugin since it only loads the stylesheet when its needed.
There are two solutions, you could copy the styles in the plugin stylesheet directly into your theme stylesheet or you could add the following function to your functions file so that it enqueues the stylesheet throughout the site.
add_action('init', 'valeuriad_enqueue_cf7ic_stylesheet');
function valeuriad_enqueue_cf7ic_stylesheet() {
wp_enqueue_style( 'cf7ic_style' );
}
Thx a lot for your answer !
I will try one of these.
Regards,
Maxime