Forums

[Plugin: Ajax Comment Posting] Initialize correction (2 posts)

  1. luiscastillocr
    Member
    Posted 2 months ago #

    Hi there, i Installed the plugin in the version 1.3 with wordpress 2.8.4, so, i found a little problem loading the js and css files, in special with the jquery file that I previously have been loaded in my WP, this creates a conflict with other jquery script that i was using.

    Checking the code I found the reason, in the file ajax-comment-posting.php the include the js and css files only with a echo

    echo '<script type="text/javascript" src="'.get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/jquery.js"></script>';
    	echo '<script type="text/javascript" src="'.get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/jquery.form.js"></script>';
    	echo '<script type="text/javascript" src="'.get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/lang.js"></script>';
    	echo '<script type="text/javascript" src="'.get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/acp.js"></script>';
    	echo '<link rel="stylesheet" type="text/css" href="'.get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/acp.css" />';

    this provoke that the jquery file is loaded 2 times and making conflict with the previously jquery file.

    Replacing the code above with the code below can prevent the conflict:

    wp_enqueue_script('jquery',get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/jquery.js');
    wp_enqueue_script('jqueryform',get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/jquery.form.js',array("jquery"));
    wp_enqueue_script('langform',get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/lang.js',array("jquery"));
    wp_enqueue_script('acpform',get_settings('siteurl').'/wp-content/plugins/ajax-comment-posting/acp.js',array("jquery"));
    wp_register_style('acpStyle',get_settings('siteurl').'wp-content/plugins/ajax-comment-posting/acp.css');
    wp_enqueue_style('acpStyle');

    I hope that this help to someone else..

    Grettings... :D

    http://wordpress.org/extend/plugins/ajax-comment-posting/

  2. physalis
    Member
    Posted 3 weeks ago #

    Hey there,

    if I do exactly what you are saying here the plugin refuses to work, it's just bypassed... are you sure it is working that way :) ? I am a php/jquery noob, if that helps ;)...

Reply

You must log in to post.

About this Topic