Hi mrbizu,
To clarify, are you trying add a new jQuery plugin, and using the code above to insert the jQuery library? If so, you shouldn’t have to include jquery again as it’s already included properly in the theme. If you want to include another javascript file, use the wp_enqueue_script function.
Hope that helps!
Thread Starter
mrbizu
(@mrbizu)
Thanks Coppaj,
Which a new jQuery plugin can i use ? Could you give a recommend, please ?
Thanks
Thread Starter
mrbizu
(@mrbizu)
A apart of the code plugin is below :
add_action('wp_head', 'fm_header');
function fm_header()
{
echo "\n\n<!-- data -->\n".'
<link href="'.get_bloginfo('wpurl').'/wp-content/plugins/fm-data/fm-style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript" src="'.get_bloginfo('wpurl').'/wp-content/plugins/fm-data/jquery.tablesorter.min.js">
</script>
<script type="text/javascript">
$(document).ready(function()
{
$("#fmdata").tablesorter( {sortList: [[1,1]]} );
$(".show").click(function () {
idstring = "#"+$(this).attr("title");
$("#contentCr").html($(idstring).html());
});
}
);
</script>
'."\n";
}
If i active this plugin, FEATURED ARTICLES is not work. If i remove code script below, It will works:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script type="text/javascript" src="'.get_bloginfo('wpurl').'/wp-content/plugins/fm-spider/jquery.tablesorter.min.js">
</script>
I try add this code to header.php but FEATURED ARTICLES still not works. I thinks this script is conflicting.
Please help me to resolve this problem.
Thanks
As mentioned by coppaj the plugin should/MUST use wp_enqueue_script to add javascript (and CSS). If not, you will always have a problem – if not today then in the future when you upgrade versions.
Don’t add add that code to header.php – it will cause the same problems but be harder to find in the future.
I suggest you contact the plugin author and get them to change the plugin to include the JS and CSS correctly.
If you have no luck with the plugin author come back here.
Ian.
+1 on Ian’s recommendation to contact the plugin author.
Thread Starter
mrbizu
(@mrbizu)
Thanks for reply me,
I sent many emails to author but he didn’t answer me. So, now I try to modify code follow your guide :
I add this function to function.php :
function custom_scripts() {
wp_enqueue_script('custom-script','http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', array('jquery'));
}
add_action('init', 'custom_scripts');
Is this correct ? Please help
You don’t need to include jQuery here.
Use this chunk of code instead – and put it in the main plugin file since you’re modifying it anyways. That way if you disable the plugin, you won’t be loading this javascript in your theme.
function custom_scripts() {
wp_enqueue_script( 'tablesorter', plugins_url( 'jquery.tablesorter.min.js', __FILE__ ), array('jquery') );
}
add_action('init', 'custom_scripts');
Let us know how it goes.
Thread Starter
mrbizu
(@mrbizu)
Many thanks Coppaj. It’s works
dear i have installed wp-bold to my site, same problem having to me also, i have enabled Featured Posts to enable Featured Articles, its showing only the title but my feature articles not showing there please
help me thank you..!
I’m sorry but as you are using a non-WPORG theme, you need to seek support from the theme’s developers – paid or otherwise. We only support themes downloaded from wordpress.org here.
i have download the theme on wordpress im using it for one of my other site, but i install it its working fine the problems is that the feature article i cant view it, maybe i don’t know how to fix it dear
Help for that commercial theme is here:
http://www.solostream.com/members/
mrbizu can you please explain how and where i want to do this please