WordPress.org

Ready to get started?Download WordPress

Forums

problem conflic using jquery code (14 posts)

  1. mrbizu
    Member
    Posted 1 year ago #

    Dear all,

    I using wordpress template wp-bold : http://wp-bold.solostreamsites.com/
    with featured narrow slider (FEATURED ARTICLES in template)
    now i add a plugin using jquery with :
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

    but featured narrow was disappeared ( not working).
    Anyone can help me to resolve this problem ?

    Thanks an advance.

  2. coppaj
    Member
    Posted 1 year ago #

    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!

  3. mrbizu
    Member
    Posted 1 year ago #

    Thanks Coppaj,

    Which a new jQuery plugin can i use ? Could you give a recommend, please ?

    Thanks

  4. mrbizu
    Member
    Posted 1 year ago #

    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

  5. ianhaycox
    Member
    Posted 1 year ago #

    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.

  6. coppaj
    Member
    Posted 1 year ago #

    +1 on Ian's recommendation to contact the plugin author.

  7. mrbizu
    Member
    Posted 1 year ago #

    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

  8. coppaj
    Member
    Posted 1 year ago #

    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.

  9. mrbizu
    Member
    Posted 1 year ago #

    Many thanks Coppaj. It's works

  10. nazmyonline
    Member
    Posted 11 months ago #

    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..!

  11. esmi
    Forum Moderator
    Posted 11 months ago #

    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.

  12. nazmyonline
    Member
    Posted 11 months ago #

    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

  13. WPyogi
    Volunteer Moderator
    Posted 11 months ago #

    Help for that commercial theme is here:

    http://www.solostream.com/members/

  14. nazmyonline
    Member
    Posted 10 months ago #

    mrbizu can you please explain how and where i want to do this please

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags