GetSimple Support Forum

Full Version: How to include .js in Cardinal Theme?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to include, i.e. fetch two .js in Cardinal Theme because of making a responsive menu. I've put the two rows at the end of template.php before </body> tag, but I can't get script to load (work):

Code:
<script src="<?php get_theme_url(); ?>/js/jquery-1.7.2.min.js"></script>    
<script src="<?php get_theme_url(); ?>/js/script.js"></script>

Is there a trick or do something wrong?

Thnx!
Also, I've just find a solution... The js include code is correct, but it must be written before the last part of code in template.php, ... see below (I still don't know why, what's the reason?):

Code:
    <div id="sidebar">
        <div class="section">
            <?php get_i18n_component('sidebar');    ?>
        </div>
        <div class="section credits">
            <p><?php echo date('Y'); ?> - <strong><?php get_site_name(); ?></strong></p>
            <p>
                Cardinal Theme by <a href="http://www.cagintranet.com" >Cagintranet</a><br />
                <?php get_site_credits(); ?>
            </p>
        </div>
    </div>
(2014-12-29, 10:42:49)gordan Wrote: [ -> ]I'm trying to include, i.e. fetch two .js in Cardinal Theme because of making a responsive menu. I've put the two rows at the end of template.php before </body> tag, but I can't get script to load (work):

Code:
<script src="<?php get_theme_url(); ?>/js/jquery-1.7.2.min.js"></script>    
<script src="<?php get_theme_url(); ?>/js/script.js"></script>

Is there a trick or do something wrong?

Thnx!

these lines seem okay.
the problem may be with the paths (the scripts in must be '/themes/Cardinal/js/'), or there might be some javascript error (check the console log)
maybe you have a .htaccess file in folder with
"Denny from all" if yes.. change it for "Allow from all"

maybe the selected theme is not a cardinal theme.. if yes.. try do it from
<script src="<?php get_theme_url(); ?>/js/jquery-1.7.2.min.js"></script>
to:
<script src="<?php get_site_url(); ?>themes/Cardinal/js/jquery-1.7.2.min.js"></script>
Thank you for the response... it was problem in sidebar content.