Custom Post Type archive page not working

I’m new to Sage, so my question might sound a little bit obvious. Right now, i’m using CPT UI to create a custom post type (Named “Work”). What i’ve done is create a template-work.blade.php file and use it as my page model. Worked fine, until i wanted to add custom javascript to it.

Obviously, i thought myself “Hey but why don’t i create an archive page instead of a tempalte file”. So i’ve created a file called archive-works.blade.php and pasted the code i’ve previously written in my template file in it. Then i deleted my template file. So now, the javascript works on this page (as my js file is called work.js) but nothing shows up on my archive page… Even if i try to write a simple h1 tag in it.

What am i missing ? Why does my archive-work.blade.php file doesn’t work ?

Thanks in advance !

You can use a JavaScript router or query for specific elements or data-attributes.
Sage 9.x already includes a JavaScript router that matches the body classes.

In the usual Sage 9/10 webpack workflow one frontend script file is generated and enqueued.

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