Jump to content
Sign in to follow this  
josh1178

Jquery Plugins and Platform

Recommended Posts

josh1178

I'm wondering what the proper practice for adding jquery plugins to Platform is. I tried simply adding code in the 'header scripts' area in the admin, but things weren't working properly. So, I added code into the header.php directly, which seems to work better (See the code below) What is the best practice for adding Jquery plugins to Platform. - Should I create a copy of the header.php file and put it in my based with the modifications? - Should I be able to use the admin 'header scripts' area? - Do I need to add things like wp_enqueue_script('jquery'); - Should I disable wordpress jquery and link to google like this article recommends? Google Jquery Thanks! Any insight from your experiences much appreciated.

	<?php
			wp_enqueue_script('jquery');
			pagelines_register_hook('pagelines_head'); // Hook
	
			wp_head(); // Hook (WordPress)
	
	?>
	<link rel="stylesheet" type="text/css" href="/css/slidingtabs-horizontal.css" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
	<script type="text/javascript" src="/js/plugins/jquery.mousewheel.min.js"></script> <!-- Optional -->
	<script type="text/javascript" src="/js/plugins/jquery.easing.1.3.js"></script> <!-- Optional -->
	<script type="text/javascript" src="/js/jquery.slidingtabs.pack.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
	
	    // Vertical tabs example
	    $('#st_horizontal').slideTabs({
	        // Your options here
	        contentAnim: 'slideV',
	        contentAnimTime: 600,
	        contentEasing: 'easeInOutExpo',
	        orientation: 'vertical',
	        slideLength: 300,
	        tabsAnimTime: 300
	    });
	
	});
	</script>
	

Share this post


Link to post
Share on other sites
catrina

Are there are any other plugins you have activated? There might be a conflict between one or a few plugins and the jquery code...


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
josh1178

Hi Catrina, thanks for writing. I think I fixed the issue and can now use the jquery code in the Admin Header Scripts area. I put the pagelines_head hook before the wp_enqueue_script and now things seem working ok. Now it looks like this:

pagelines_register_hook('pagelines_head'); // Hook
			wp_enqueue_script('jquery');
			wp_head(); // Hook (WordPress) 

Share this post


Link to post
Share on other sites
kastelic

You can always put jQuery code in the footerscripts area instaed, as this is best-practice anyway, and ensures that it is coming after the call to the jQuery library.

Share this post


Link to post
Share on other sites
josh1178

Good tip, thanks Jimmy!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×