Viewing 10 replies - 1 through 10 (of 10 total)
  • 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!

    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;}

    Thread Starter andrianiannalisa

    (@andrianiannalisayahooit)

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

    Thanks.

    Annalisa

    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: https://codex.www.ads-software.com/Function_Reference/wp_enqueue_script

    That’s it!

    Thread Starter andrianiannalisa

    (@andrianiannalisayahooit)

    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!

    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.

    Thread Starter andrianiannalisa

    (@andrianiannalisayahooit)

    This is my website URL

    https://www.laruveseonoranze.it/

    My WP version i s 3.5.2.

    Thanks

    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 ??

    Thread Starter andrianiannalisa

    (@andrianiannalisayahooit)

    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!

    Thread Starter andrianiannalisa

    (@andrianiannalisayahooit)

    Dimenticavo… grazie per l’aiuto!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘position input image box’ is closed to new replies.