# Load specific css y javascript

**URL:** https://discourse.roots.io/t/load-specific-css-y-javascript/15244
**Category:** sage
**Tags:** sage9
**Created:** 2019-04-05T03:37:56Z
**Posts:** 3

## Post 1 by @helgi — 2019-04-05T03:37:56Z

In sage I can load specific javascript files. WordPress allows to load css by template implemented the function is\_page\_template (). I have a virtual page, which is not a type of content.  
How can I load css and javascript with sage in a virtual page created with the filter generate\_rewrite\_rules?

Thanks for the help

---

## Post 2 by @mmirus — 2019-04-05T16:34:48Z

Hey @helgi - see if instead of checking for the page template you can check for whatever query vars, etc., your rewrite rule is working off of.

---

## Post 3 by @helgi — 2019-04-09T13:27:12Z

Greetings @mmirus. I did it in the following way in the file setup.php:

```
global $wp_query;

if (isset($wp_query->query_vars['rents'])) {
	wp_enqueue_style(
		'sage/styles.css',
		asset_path('styles/style.css'),
		false,
		null
	);
}
```

Thanks for the suggestion

---

## Post 4 by @system — 2019-05-17T03:37:58Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
