Wordpress template doesn't find php file - php

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.

Related

Wordpress Theme + SSL doesn't work [duplicate]

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.

Path to another css from a no-extension file in zend

I have got a project built in Zend-framework V1, where the link to another css file from a no-extensioned file is assigned in this way.
In the header file
<link rel="stylesheet" href="<?php echo $this->baseUrl() ?>/assets/user/css/login.css" type="text/css" media="all" />
But the public folder structure is like the below
public/assets/user(now this user is a file without any extension)
and when I open this "user" file I get the following line
../../packages/user/public/assets/user
I can find the login.css which is under
packages/user/public/assets/user/css/login.css
This is working fine in live but my local is not detecting the correct css.
Any help is highly appreciated. Many thanks in advance.

Issue linking CSS to backend Zend Framework 1

I am working on a Zend Framework 1 application. It is successfully installed on my localhost and is working without any problems. However I've noticed that the css for the back end of the application is not working.
When I view the page source I can see the stylesheet has been loaded and can click on the link to it to view in the browser.
However the style is not applied to any of the elements on the screen and I do not understand why.
This is the layout file for the page: (adminstyle.css is not loading...)
<link href="/css/adminstyle.css" media="all" rel="stylesheet" type="text/css" title="default" />
<link rel="stylesheet" href="/css/smoothness/jquery-ui-1.10.2.custom.min.css">
<link rel="shortcut icon" href="images/favicon_2.ico" />
</head>
does anyone know what might be causing this issue? Apologies for the question if it seems stupid but I'm not really experienced with this sort of thing and I am trying to get to the bottom of it. Any help is much appreciated.
I can provide more details if required, I just do not want to post lots of unescessary snippets of code up.
Here is the right way to write links in zend framework cause with your way it will work just for the index/index , for other view you won't get the style css applied :
<link rel='stylesheet' type='text/css' href="<?php echo $this->baseUrl()."/css/style.css"; ?>" >
the same for your js files
hope it helps.

WAMP + PHP CSS Include wont update with new styles

I am stumped. I am using includes to import a style sheet. If I add a new style to the style sheet, generated pages will not display ANY of the new css. If I change an old css rule it WILL display the change. I thought it might be a cached file of some kind, but I have cleared the cache in all testing browsers and the problem persists.
At first I thought it was a WAMP issue, but the problem happens when I move it all live as well so now I am thinking I am doing something wrong with the includes....
<link rel="stylesheet" type="text/css" href="css/foundation.css">
<!-- Included Custom Overides -->
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
<!-- Supersizer CSS -->
And this is simply my include...
<?php require("Includes/HEADER.php"); ?>
Again, all the old CSS works fine, just any new additions to any of the style sheets will not display.
Thanks
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
Maybe "Custon_Foundation_Overides.css" is a typo and you meant "Custom_Foundation_Overrides.css" or maybe you have to upload the file with correct letters capitalization.
Sounds like a browser cache issue. A simple way to fix this while maintaining good caching practices would be to pass the file make time as a query var to the file.
<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=<?php echo filemtime('css/foundation.css');?>">
This will generate a string like:
<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=1382564850">
This way when you update the file your browser will think its a new file and cache that, but as long as the file remains unchanged it will have the same name and maintain the browser cache.

Stylesheet not loading. URL duplicating on click

I have a big prob. We have a site that was working just fine but I was doing some fine tuning and somewhere along the line i messed things up. possibly in the .htaccess file.
My problem is that my css style sheet doesn't load nor do my images. ahh! They are all there.
I emptied my .htaccess file and deleted my robots.txt just to eliminate any blocking but that didn't fix it.
I validated my css file with The W3C CSS Validation Service and it said:
file not found: http://easybuildingproducts.ca/www.easybuildingproducts.ca/style.css
I feel like it has something to do with the fact that the URL is duplicated. It does that now when i click a link to any of my pages. It should be either or not both those links together. Is it possible a google cached my .htaccess or robots.txt when there was a potential redirect error? Is there a loop happening somewhere?
I was in the midst of making a custom 404 error page when this all went down.
www.easybuildingproducts.ca
Easy fix
<link href="www.easybuildingproducts.castyles/inside.css" rel="stylesheet" type="text/css">
That needs to be either one of the following
<link href="/styles/inside.css" rel="stylesheet" type="text/css">
or
<link href="http://www.easybuildingproducts.ca/styles/inside.css" rel="stylesheet" type="text/css">
I looked at the actual website source to find this example. there are quite a lot like it
Change the href to "/style.css" instead of writing your full domain out. Do the same kind of thing for all other resources that failed to load, too.
This will fix your problem, and it will also make your markup compatible if you decide to migrate to a different dsomain name in the future.
Your resources aren't being loaded (css, js, jquery, etc). Take a look at the screenshot taken from my Chrome Dev Tools > Sources tab:
This is because of your resources' file paths. It is definitely not a good idea to reference all of your resources with "www." in the file path.
Change
<link href="www.easybuildingproducts.castyle.css" rel="stylesheet" type="text/css" />
into
<link href="/castyle.css" rel="stylesheet" type="text/css" />

Categories