It may work by inserting the JS and CSS files before the [insert_php] tag instead of including them in the myFileName.php file.
<script src="/file.js"></script><link rel='stylesheet' type='text/css' link="/file.css">[insert_php]
include("myFileName.php");
[/insert_php]
(I’m putting the script and link tags on the same line as [insert_php] so WordPress doesn’t insert extraneous
tags.)
Will
Thread Starter
nhoa88
(@nhoa88)
So, as you say Will, I put this way:
<script src=”./jquery.js”></script><script src=”./jquery.dataTables.js”></script><link rel=’stylesheet’ type=’text/css’ link=”./jquery.dataTables.css.css”>[insert_php]
include(“myFileName.php”);
[/insert_php]
Buit it doesn’t work 🙁
Sorry it doesn’t work. What I did was suggest, as you had requested. But if the JavaScript and CSS don’t work then they don’t work.
Maybe it has to do with how you’re importing them. Try removing the leading dots from the URLs. src=”/jquery.js” instead of src=”./jquery.js” for example.
Will
Thread Starter
nhoa88
(@nhoa88)
Thank you for your reply Will.
I have already tried that, but it doesn’t work. I’m sure that my CSS and JS files works because if i try them outside wordpress it works.
The problem is that I don’t know where I have to put these files to work.
Could anyone help me please?
One more thing to try is use the full http://… URL instead of relative URL for your src and link attribute values.
Will
Thread Starter
nhoa88
(@nhoa88)
I have tried also with another example that I have that it doesn’t use CSS files, it use 3 JS files.
So, with this new example:
I don’t understand very well why it is not enough if I put this code inside the php that I’m including in the wordpress page.
This is what I have inside the php.
<script src="./highcharts.js"></script>
<script src="./highcharts-more.js"></script>
<script src="./data.js"></script>
But i have tried what you say. Removing these three line in the php and put this way in the page.
<script src="/highcharts.js"></script><script src="/highcharts-more.js"></script><script src="/data.js"></script>
[insert_php]
include("myFileName.php");
[/insert_php]
(Also I have tried with the full URL but nothing)
🙁 I guess that you have used this kind of examples with your plugin, no?? I mean, a php including javascript funcionality.
Thank you!!
Thread Starter
nhoa88
(@nhoa88)
Resolved! The problem was that my JS file was interpreting wrong. I don’t know if it was because of the plugin or what but it was addding ‘</p>’ in blank spaces.
Thanks for the help Will!