0

I have some Jquery links in my header. First off I am probably not using the proper wordpress function to do this. Right now on my site the code that is below is not working. These links aren't there, but in my ftp directory they exist. I am not sure what I am doing wrong? I can link to the live site if needed.

<link type="text/css" href="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel=stylesheet />
<script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>
<script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>

and here is the code before output

 <?php $url = content_url();?>
<link type="text/css" href="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel="stylesheet" /> 
<script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>
<script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>
3

1 Answer 1

2

The proper way to include styles and scripts is with the wp_enqueue_script() and wp_enqueue_style() functions. The codex pages on both of these functions covers how to use them very well. Basically you just need to give the script the source (do it relative to your current PHP file) of the script/style and a slug to reference it by. If you're enqueueing conditionally, then you should look at wp_register_script() and wp_register_style() as well.

3
  • I will try this. My wordpress just started acting up with something else, so I am reinstalling. Feb 21, 2012 at 0:52
  • I really couldn't figure this out, could you explain a little bit. Feb 21, 2012 at 4:41
  • What part of it is confusing you? If it's complicated, it may be served with a better question...I know implementation of the enqueues has been hashed and rehashed dozens of times on this site, have you tried looking at any of those?
    – mor7ifer
    Feb 21, 2012 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.