By using Elementorforum.com’s services you agree to our Cookies Use and Data Transfer outside the EU.
We and our partners operate globally and use cookies, including for analytics, personalisation, ads and Newsletters.

  • Join the Best Wordpress and Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!

Loading style 'example.css' in a specific element made by elementor

K

kml93

New Member
Hi there,

I'm looking for a solution to load an 'assets/styles/example.css' file for an element made with elementor only when this element is visible on the page. This element is a custom template with 302 ID.

I don't want to use elementor's 'Custom CSS' function because I'll need to deploy updates to this file on several website later.

I have access to my file functions.php.

My ID of post is 302. I try the condition is_page(),is_singular() and is not recognize.

```php
define('KS_CSS_PATH', get_stylesheet_directory_uri() . '/assets/css/'); if (! function_exists('load_example_style')): function load_example_style(){// if (is_page(302)){wp_enqueue_style('ks-example-css', KS_CSS_PATH . 'example.css'); // } } endif; add_action('wp_enqueue_scripts', 'load_example_style', 21);
```

Actually I load in every page.
 
Last edited:

Latest posts

Latest Resources

Other Elementor Resources

elementor official
Top