• Resolved mdubey

    (@mdubey)


    Dear sir,

    I have small issue in my wordpress website https://araldimissioni.it

    the website is almost done but now i want to change my url through permalink from wordpress dashboard but when i am changing permalink from default to post title

    posts are showing fine but jquery and javascript file have some issue related to

    Failed to load resource: the server responded with a status of 404 (Not Found)

    you can see my home page working fine but all other pages have this issue about resources not found through inspection of page

    please give me any idea to resolve this issue

    please look this post

    https://araldimissioni.it/novena-della-medaglia-miracolosa/

    but when i am changing my permalink to default all problem automatically resolve

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mdubey

    (@mdubey)

    hello sir ,

    is there any one who can solve my problem

    please i need your help

    Thanks

    you are referencing all your js files incorrectly.

    i.e.
    <script src=”js/jquery.cookie.js”></script>
    will look for js/jquery.cookie.js

    on home page that resolves to:
    https://araldimissioni.it/js/jquery.cookie.js

    on inner pages, that resolves to:
    https://araldimissioni.it/missione-mariana/conosce-la-missione-mariana/js/jquery.cookie.js

    Add / in front so it always goes back to the root directory:
    <script src=”/js/jquery.cookie.js”></script>

    The best way to call js in wp is to create an function to call js, and put your code in function.php , use wp function “wp_enqueue_script”

    example:

    function js_scripts() {
    	//javascript
        wp_enqueue_script( 'jquery', get_template_directory_uri() . '/assets/js/jquery-2.1.1.min.js', array(), '4', true );
        wp_enqueue_script( 'prettyPhoto', get_template_directory_uri() . '/assets/plugins/prettyPhoto/jquery.prettyPhoto.js', array(), '3', true );
    
    	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    		wp_enqueue_script( 'comment-reply' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'js_scripts' );

    Thread Starter mdubey

    (@mdubey)

    Great ,

    Thank you for your valuable suggestion , i problem has been resolved

    so many thank you both of you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to fix resource issue like jquery and javascript’ is closed to new replies.