This question already has answers here:
WordPress: Loading multiple scripts with enqueue
(3 answers)
Closed 12 months ago.
I have an application that I'm trying to include in a wordpress page, I passed it the include of the index.php file and everything is displayed but when it looks for the JQuery and Bootstrap files for the style these are not detected.
The style files are located in the same folder as the index file and I pass them as follows (they are just examples):
<link rel="stylesheet" href="include/bootstrap4/css/bootstrap-select.min.css">
<link rel="stylesheet" href="include/bootstrap4/css/bootstrap.min.css">
<link rel="stylesheet" href="include/bootstrap4/other/jquery-ui.css">
<script src="include/bootstrap4/other/jquery-3.3.1.min.js"></script>
Also I tried to include Bootstrap with cnd and the style is detected but with Jqueys still nothing.
The application without the jquery files does not work, can anyone tell me how I can include bootstrap and Jquery in the page?
If you want to add files just enough, use the parameter get_template_directory_uri():
<link rel="stylesheet" href="<?php echo get_template_directory_uri() . '/your/path/and/file.css' ?>">
But don't do that.
Better to use CDN with these libraries as it has very good compression and file caching support.
Take a look here getbootstrap
Related
I am creating a template page in Wordpress that contains a custom contact form in it, using php and ajax.
I have two files in the same directory:
wp-content/themes/verbo/template01.php (contact form) and wp-content/themes/verbo/sendEmail.php (ajax)
In template01.php I have the ajax request like this:
xhttp.open("POST", "sendEmail.php", true);
However, that line is giving me an error:
"failed to load resource server responded with status 404"
template01.php and sendEmail.php are in the same directory, so the problem is not in the reference, I think. I even tried with absolute references, but the result is the same.
This form works on my localserver. Just not as a Wordpress template.
I was having the same problem with my styles.css. After googling it a bit, I solved it by replacing <link rel="stylesheet" type="text/css" href="style.css" media="screen"> with <link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri();?>/style.css" media="screen">.
So, I guess the problem lies with how wordpress handles these things.
I am not very experienced with wordpress so, any help is appreciated.
This question already has answers here:
CSS doesn't work on HTTPS pages in Chrome and IE
(2 answers)
Closed 7 years ago.
My personal blog works when you connect via http but not with https. When you use https it doesn't load the CSS code. Any ideas? The certification is via Let's Encrypt program.
My site:
http://nicktehpro.xyz/
Broken Link:
https://nicktehpro.xyz/
At each place in the document where u have used:
href="http://nicktehpro.xyz/wp-content/themes/enigma/style.css"
Please change it to:
href="wp-content/themes/enigma/style.css"
or use a protocol relative uri:
href="//nicktehpro.xyz/wp-content/themes/enigma/style.css"
because your references are non-secure links they are avoided when using a secure connection
It looks as though there is an error accessing the stylesheets, images, and other objects you are linking to on the page. When you go to https://nicktehpro.xyz, it is trying to load other links from http://nicktehpro.com Its not allowing you to load insecure data onto a secure page. Make sure that you are either loading all from http or https not a mixture of both. you can fix this by using relative links, starting with
href="/wp-content/link-to-file"
or
src="/wp-content/link-to-file"
instead of
href="http://nicktehpro.xyz/wp-content/link-to-file"
all the links should start with https which is not the case for your css and js files , example :
<link rel="stylesheet" href="http://nicktehpro.xyz/wp-content/themes/enigma/style.css" type="text/css" media="screen" />
should be
<link rel="stylesheet" href="https://nicktehpro.xyz/wp-content/themes/enigma/style.css" type="text/css" media="screen" />
and the other links too
I went ahead and downloaded the theme you're using to further help you, navigate to Header.php and replace on
line 18
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
with <link rel="stylesheet" href="/wp-content/themes/enigma/style.css/" type="text/css" media="screen" />.
EDIT:
After looking into it' there's also a plugin which can achieve this for you for anything that may not be working because it displays as http and not https you should consider giving it a try here.
I have the php file and in that I am linking a HTML file.
include 'practice.html';
In the HTML file I have a few CSS files linked.
<link href="practice1.css" rel="stylesheet" />
<link href="practice2.css" rel="stylesheet" />
Now, what is happening is the Page Template is displaying only the HTML part and not able to access the CSS files.
How can I possibly use CSS files?
PS : ALL my PHP, HTML, and CSS files are under the same folder (wordpress\wp-content\themes\*).
On your PHP template page, use:
<?php require(TEMPLATEPATH.'\practice.html'); ?>
And on your HTML page, use:
<link href="\wordpress\wp-content\themes\YourThemeName\practice1.css" rel="stylesheet">
<link href="\wordpress\wp-content\themes\YourThemeName\practice2.css" rel="stylesheet">
Make sure to replace YourThemeName with, your theme's name. And also to provide the correct path of where your CSS files are located.
If your wondering about what TEMPLATEPATH does, it provides the path to the template in use by WordPress so you do not have to type out the full path ex. \wordpress\wp-content\themes\YourThemeName\
Are you working on a local server or a live website? Depending on which one it is, you will have to change up the paths.
Example:
For a live website use:
/wordpress/wp-content/themes/YourThemeName/
or
For a local server use:
\wordpress\wp-content\themes\YourThemeName\
try using Include PHP function for including HTML file and for the CSS you can simply use echo
<?php
echo '<link href="practice1.css" rel="stylesheet">';
include('practice.html');
?>
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How To Include CSS and jQuery in my wordpress plugin?
I was going to add a button on a wordpress plugin
I want to add a style on button I know the basic way to call a css into a html file like.
<link rel="stylesheet" type="text/css" href="buttonPro.css">
but its not working on a php file
You can call it like this:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>
/css/style.css" media="screen" />
When your style sheet is living in a subdirectory called 'css' and the actual file is called 'style.css'. Don't forget to escape the HTML code in php:
<?php
put some php code here
?>
**put some HTML code here**
<?php
now you can continue with php
?>
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
CodeIgniter - Loading CSS
I try load css file and it's not work.
this is the link tag:
<link rel="stylesheet" type="text/css" href="application/styles/style.css" />
how i can do this?
Make a folder outside the application folder Eg: resources/css/style.css and link it like below.
Then the folder structure will be like this,
-application
-resources
-system
-index.php
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/css/styles/style.css" />