WordPress.org

Ready to get started?Download WordPress

Forums

Comment Images
position input image box (11 posts)

  1. andrianiannalisa
    Member
    Posted 1 year ago #

    How can I change the position of the input image box?
    I would like it is above submit Comment button.
    Best regards.
    Annalisa

    http://wordpress.org/extend/plugins/comment-images/

  2. evster
    Member
    Posted 8 months ago #

    I too am in search of a solution for this. If anyone can point me in the right direction of a future-proof way to implement this change on my own I would be greatly appreciative. Many thanks!

  3. Tony
    Member
    Posted 7 months ago #

    Ok guys, I came up with a jquery fix. It is nice and simple solution:

    // Position "browse image" in comments above the "post comment" button
    jQuery(function ($) {
    	$('p.form-allowed-tags').after($('#comment-image-wrapper'));
    });

    Include this code in your custom js script and voila! You can also add this css to your css file:

    #comment-image-wrapper {margin: 0 0 20px;}

  4. andrianiannalisa
    Member
    Posted 7 months ago #

    Hi tonyzg,
    where should I put this code?
    Where can I find custom js script?

    Thanks.

    Annalisa

  5. Tony
    Member
    Posted 7 months ago #

    Hi andrianiannalisa,

    Here is how to do that:
    1. Create custom.js file (if your theme does not have one already) and put this code in it:

    // Position "browse image" in comments above the "post comment" button
    jQuery(function ($) {
    	$('p.form-allowed-tags').after($('#comment-image-wrapper'));
    });

    2. Upload custom.js file to your theme's js folder (usually it is wwwroot/wp-content/themes/[your-theme]/js/)

    3. Enqueue custom.js file to your theme. Here is a code that you need to paste to your functions.php theme file:

    /**
     * enqueue custom.js script
     */
    function custom_script() {
    	wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), '1.0.0', true );
    }
    
    add_action( 'wp_enqueue_scripts', 'custom_script' );

    See here for reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    That's it!

  6. andrianiannalisa
    Member
    Posted 7 months ago #

    Hi tony,
    I followed your instructions I have created a file custom.js because my theme had not, and then I added the code that you told me.
    Then, I have pasted other code in function.php but it does not work!

  7. Tony
    Member
    Posted 7 months ago #

    Please post your website url here so I can take a look at the source code. What is your WP version?

    There is probably some jQuery issue on the website. You can see JS errors in FF Firebug console if any, so that can help you with debuging.

  8. andrianiannalisa
    Member
    Posted 7 months ago #

    This is my website URL

    http://www.laruveseonoranze.it/

    My WP version i s 3.5.2.

    Thanks

  9. Tony
    Member
    Posted 7 months ago #

    I see where the problem is. You did not add enqueue custom.js script to functions.php file. Instead you added it to header.php or some other file.

    That said, make sure enqueue custom.js script is added to functions.php file that can be found at your theme's folder.

    Also since your comments template is different than default one, you should change your code in custom.js file to this:

    // Position "browse image" in comments above the "post comment" button
    jQuery(function ($) {
    $('#comment').after($('#comment-image-wrapper'));
    });

    Everything else seems good to me.

    Saluti :)

  10. andrianiannalisa
    Member
    Posted 7 months ago #

    I have changed the code in custom.js and I had added at the end of the file function.php of the theme this code:

    /**
    * enqueue custom.js script
    */
    function custom_script() {
    wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), '1.0.0', true );
    }

    add_action( 'wp_enqueue_scripts', 'custom_script' );

    But it doesn't works!

  11. andrianiannalisa
    Member
    Posted 7 months ago #

    Dimenticavo... grazie per l'aiuto!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic