Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM How to include .js in Cardinal Theme?
#1
Question 
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!
Reply
#2
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>
Reply
#3
(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)
Reply
#4
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>
user plugin: scroll to top
Reply
#5
Thank you for the response... it was problem in sidebar content.
Reply




Users browsing this thread: 1 Guest(s)