- This topic has 4 replies, 2 voices, and was last updated 3 years ago by
Tom.
-
AuthorPosts
-
February 1, 2020 at 2:37 pm #1151668
Denise
Hello GP Friends,
I am using DataTables to create an index on my site: Explore AI Ethics. I need to reference the .js scripts, but only for the index page, not the entire site. What is the best way to do this? For now, I created an Element to put the code in the footer and display on just the Index page. It seems to be working, but I’m not sure if this is the is optimal for speed, etc.
Thanks,
Denise—————————————————–
<!– DataTables CSS –>
<link rel=”stylesheet” type=”text/css” href=”https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css”/>
<link rel=”stylesheet” type=”text/css” href=”https://cdn.datatables.net/select/1.2.6/css/select.dataTables.min.css”/>
<link rel=”stylesheet” type=”text/css” href=”https://cdn.datatables.net/buttons/1.5.4/css/buttons.dataTables.min.css”/>
<link rel=”stylesheet” type=”text/css” href=”https://cdn.datatables.net/responsive/2.2.2/css/responsive.dataTables.min.css”/><!– DataTables plugin and extensions –>
<script type=”text/javascript” src=”https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js”></script><!– DataTables select rows –>
<script type=”text/javascript” src=”https://cdn.datatables.net/select/1.2.6/js/dataTables.select.min.js”></script><!– DataTables buttons –>
<script type=”text/javascript” src=”https://cdn.datatables.net/buttons/1.5.4/js/dataTables.buttons.min.js”></script>
<script type=”text/javascript” src=”https://cdn.datatables.net/buttons/1.5.4/js/buttons.html5.min.js”></script>
<script type=”text/javascript” src=”https://cdn.datatables.net/buttons/1.5.4/js/buttons.print.min.js”></script><!– DataTables responsive –>
<script type=”text/javascript” src=”https://cdn.datatables.net/responsive/2.2.2/js/dataTables.responsive.min.js”></script>February 1, 2020 at 2:38 pm #1151669Denise
And is the code that I pasted the correct way to reference the files?
February 1, 2020 at 4:44 pm #1151732Tom
Lead DeveloperLead DeveloperHi there,
I don’t see any issues with doing it this way.
However, that’s a lot of JS to load – I would recommend finding a way to trim that down.
Let me know if you need more info ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 1, 2020 at 10:28 pm #1151808Denise
Thanks, Tom.
February 2, 2020 at 9:07 am #1152206Tom
Lead DeveloperLead DeveloperNo problem ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.