I am using Polylang free to create a multilingual Wordpress website. My scripts are being loaded like this:
<script src="<?php bloginfo( 'url' ); ?>/wp-content/themes/themename/js/scripts.js" type="text/javascript"></script>
Which is true for the default language because Polylang does not change the default url: sitename/post.
When switching to English the url changes, therefore script files are lost, because there is no corresponding locale structure: sitename/en/post.
Console error in inspector (ignore link):
Loading failed for the with source “http://localhost:8888/sitename/en/wp-content/themes/themename/js/scripts.js”.
Help?
Solved
It's not Polylang's fault or anything.
Script src should go like this:
<script src="<?php echo get_template_directory_uri(); ?>/js/scripts.js" type="text/javascript"></script>
Related
I want to build a pwa from my wordpress site and I don't want to use any plugin to do so how do I add a manifest.json file to my wordpress site please?
Open your function file from your theme directory and add the following code
//manifest file
add_action( 'wp_head', 'inc_manifest_link' );
// Creates the link tag
function inc_manifest_link() {
echo '<link rel="manifest" href="'.get_template_directory_uri().'/manifest.json">';
}
I'm having a strange issue in my Laravel 5.2 app. Specifically with loading some CSS and JavaScript files. I have this in the folder public/assets so, I have something like this:
|--public
|----/assets
|-------/css
|------------/auth
|---------------login.css
|----------main.css
|-------/js
|---------email.js
|---------/modules
|------------faq.js
That is my directory, so I'm loading the CSS with:
<link href="{{ URL::asset('assets/css/main.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/css/auth/login.css') }}" rel="stylesheet" type="text/css" />
And the JavaScript files with:
<script src="{{ asset('assets/js/email.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/modules/faq.js') }}" type="text/javascript"></script>
Also I'm loading another files as well but I'm explaining the basic situation. So, the thing is that the load of login.css and faq.js are giving me 404 error but the other files are loaded correctly, I even checked open the files through the absolute paths and they're loaded fine, also I made chown to www-data of the public folder but nothing works, so I don't know why a 404 error is triggered. What else should I check?
In the console of the browser the links that are loaded are:
http://mydomain/assets/js/modules/faq.js
http://mydomain/assets/css/auth/login.css
But they give 404 error, and the other files doesn't
first check those 404 files are in there definitely
check those files have readable permisstion
I am trying to set up a website using Jekyll and GitHub Pages (first-timer), and most importantly, to style it with Bootstrap.
You can check what I have already done:
GitHub repository: https://github.com/thibaudclement/wallaby
GitHub page: http://thibaudclement.github.io/wallaby/ (check gh-pages branch)
Also, I followed this tutorial to import Bootstrap into the Jekyll structure.
Layouts and includes seem to work just fine, but I don't understand why my index.html does not get "styled" as it should, fetching information into the css/style.css file.
Any idea of what I am doing wrong?
Thanks.
The path to your css file is incorrect - it's not loading if you check your browser console
"Failed to load resource: the server responded with a status of 404 (Not Found) - http://thibaudclement.github.io/wallaby/style/site.css"
In _config.yml, you need to set baseurl: /wallaby.
And use {{ site.baseurl }} to load resources like this :
<link href="{{ site.baseurl }}/css/style.css" media="screen" rel="stylesheet" type="text/css" />.
See Jekyll documentation.
I have a folder 'css' in the root and all.css inside it.I am using a link for the external css file as
<link href="<?php echo base_url(); ?>css/all.css" rel="stylesheet" type="text/css"/>
base_url being
$config['base_url'] = 'http://localhost/CodeIgniter/';
I thought it should work but I am getting the error as
Failed to load resource: the server responded with a status of 404 (Not Found) .
help please..
i'm currently trying to implement "UPLOADIFY" to a wordpress template page.
I implemented it well, because almost everything is working now, except the Upload doesn't start, but the reason therefore is propably not wordpress.
It's propably the folder I set where i want to upload the files to.
The folder lies in my root of the page and normally i'm connecting to it with an ftp client. If i call the folder in my browser with http://www.mywebsite.com/fileupload the browser tells me forbidden.
However, that's not the only folder which is not working. it doesn't actually matter which folder i'm creating and what permissions i give it, the upload will not start.
<script type="text/javascript">
$(document).ready(function() {
jQuery('#fileselect').uploadify({
'uploader': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.swf',
'script': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.php',
'folder': 'http://www.mydomain.com/test', //or just /test
'multi' : 'true',
'cancelImg': '<?php bloginfo('template_url'); ?>/uploadify/cancel.png'
});
});
</script>
i tried creating a new directory in my root of my website called "test" and i gave it all permissions 777. However the upload will not start.
do you guys have an idea, what i could do wrong? is there a debug mode or so?
please guys help me, i would love to make uploadify working.
in your $(document).ready function you need to add
'auto': true,
Also I would recommend removing the quote from multi since it is a boolean not a string
<script type="text/javascript">
$(document).ready(function() {
jQuery('#fileselect').uploadify({
'uploader': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.swf',
'script': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.php',
'folder': 'http://www.mydomain.com/test', //or just /test
'multi' : true,
'auto' : true,
'cancelImg': '<?php bloginfo('template_url'); ?>/uploadify/cancel.png'
});
});
</script>
I don't know about this addon, but it seems wrong for me that you set the upload folder in the client side, for obvious security reasons.
I'm sure the plugin have some settings on server side, like an array of available accepted upload locations. Besides, if accessing a folder from your browser says forbidden, it's probably due to that server configuration prevent directory listing, and it doesn't mean it's forbidden for the script to write/upload/create files in it.