Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

clsimco on "Help please...Script loading format breaks page functionality"

$
0
0

Thanks for reading, and in advance, your help.

I'm really a a novice but am learning as I go and have encountered this problem when trying to get an Isotope gallery to work on a page on my site. As a result of trying to solve that I have encountered a couple of oddities.

In order:

Live site is : clsimco.com
Page with Isotope is: clsimco.com > About > Gallery

Problem is: Script loading function written into the theme (bootstral-WP) allows scripts to load and things to work correctly but when you check developer tools there are 404 errors for those same scripts that are working on the pages. Eg: drop-down menus and modals etc. work.

I then added a page for Isotope Gallery and using existing loading function Isotope will not work.

I investigated and came up with this info:
functions.php enqueues the scripts like this

<code>
function bootstrapwp_scripts_loader() {

    if (is_singular() && comments_open() && get_option('thread_comments')) {

        wp_enqueue_script('comment-reply');

    }

    wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/assets/js/test-js/bootstrap/js/bootstrap.min.js', array('jquery'), '1.0', true);
    wp_enqueue_script('demo.js', get_template_directory_uri() . '/assets/js/bootstrapwp.demo.js', array('jquery'),'1.0',true);
</code>

etc.etc. You see the forward slash / before the start of the complete ed url.

Footer Template has the following code:

<code>
 <?php wp_footer(); // js scripts are inserted using this function ?>
    <script src="//use.edgefonts.net/cardo:n4,i4,n7:all;pontano-sans:n4:all;meddon:n4:all.js"></script>
	<script src="<?php echo get_template_directory_uri(); ?>assets/js/bootstrapwp.demo.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>assets/js/test-js/jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>assets/js/test-js/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
</code>

Note the lack of the forward slash / at the beginning of the url

You can View Source on the home page and gallery page to see an view my comments to help

Where the REAL problem lies and is where I am at is this:

Something seems at odds in the script loading.
As a result I do not seem to be able to use the same script loading to get the Gallery page to work with isotope AND have the menus work. Or if the menus work Isotope does not work.

My workaround for the moment is to have separate footer templates with different coding so the Gallery Isotope will work, but the menus do not, and have another footer template for the rest of the site and it works fine but produces 404's.

Any ideas much appreciated. Im stumped


Viewing all articles
Browse latest Browse all 8245

Trending Articles