G'day
Is there a way to reference external css/js files from content template/post forms css and js editor ?
Typically I want to use some custom css on some templates/forms and different css on others....
I can achieve this at the moment by copy and paste of the CSS, but this means duplicating a lot of CSS across many templates, and when I chaneg one I have to change them all
also the use of CDNs is becoming popular...so I was thinking of using both bootstrap CSS CDN and my own CSS hosted on AWS s3 so I can use it for many sites.
hidden link
So far I can only see how to do this either in functions.php or in the html header of each page both of which seem either too often or too pervasive.
Perhaps I am approaching this the wrong way ?
If there is no way I have been thinking about loading the bootstrap 4 cdn sitewide... but it seems to be not fully supported yet ?
thanks for any ideas you have in advance
bryan
Typically I want to use some custom css on some templates/forms and different css on others....
That is the exact reason for the JS and CSS editors on each form or view or CT, so you can apply the code on single items
If you want to apply the code everywhere you would then use theme's css and js files.
Bootstrap 4 is not yet supported by Toolset but in the works.
You could load single code files with a script search tag/link rel in the HTML of the CT's or Views or even forms, that should work to load exclusive repeating code on several parts of your website.
But that is often not considered semantically perfect.
hidden link
hidden link
Or, @import (also not really seen well in WordPress, but used)
Beda
thanks but I think this is what I pointed out...
1. whole site CSS > in theme functions.php
2. various pages >> template
3. single page >> html header
in my opinion the purpose of a template to to apply to many pages, but not the whole site.
such a template might even be used on many sites...
so the ability to load an external css or js file in the template seems an obvious need to me. The problem is I see to need to have the actual CSS and not a reference in the JS and CSS editors ... is that right ?
thanks
I understand that you have the same code you want to re-use on different locations and instead of copy paste that, you would like to have it saved somewhere and refer to it instead.
It makes sense but is not possible like that. The application of the code itself is possible, that is what I wanted to point out.
IF you copy paste, you can do exactly what you want, but you are correct, that you cannot save you the step of (the minimal) copy paste the code again (since a global application of the code as well is not adequate).
I have filed the request to be upvoted by the users and considered by the Developers in a future Roadmap.
https://toolset.com/feature-request/develop-a-method-to-load-external-scripts-js-css-in-toolset-editors/
https://toolset.com/feature-request/?wpv_post_search=Develop+a+method+to+load+external+scripts+%28JS%2C+CSS%29+in+Toolset+Editors&wpv-wpcf-plugins=Views&wpv_sort_orderby=post_date&wpv_sort_orderby_as=string&wpv_view_count=686737
Beda, thanks for doing that... I appreciate your help
cheers