WordPress.org

Support

Support » Plugins and Hacks » [Resolved] my plugin is causing problem in the media uploader???

[Resolved] my plugin is causing problem in the media uploader???

  • I created a simple plugin for my personal use that allow my MU users to use shortcodes to enter some data, this gives them a easy way to use some formatting I have setup.

    Anyway, I added some jquery that shows/hides sections by click on a link. However, this script is causing issues within the admin, more specifically in the file image upload section, where you “show/hide” the details for an image in the media library.

    I am a newbie, that had to do alot of reading to make this plugin work. It works great besides that conflict in the media gallery.

    I tried using the “no conflict mode” by adding jQuery(document).ready(function($) around the script, but that didnt seem to help.

    Can someone PLEASE help me on this! I’ve spent hours on this plugin and don’t want to scrap it!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here is some of the code i’m using.

    In the main .php plugin file…

    wp_enqueue_script('myscript', '/wp-content/plugins/myPlugin/js/script.js', array('jquery'));

    The script…

    jQuery(document).ready(function() {
    	var showText='Show/Hide Details';
    	var hideText='Show/Hide Details';
    	var is_visible = false;
    
    	jQuery('.toggle').prev().append('<a href="#" class="toggleLink">'+showText+'</a>');
    	jQuery('.toggle').hide();
    
    	jQuery('a.toggleLink').click(function() {
    		is_visible = !is_visible;
    		jQuery(this).html( (!is_visible) ? showText : hideText);
    		jQuery(this).parent().next('.toggle').toggle('slow');
    		return false;
    	});
    });

    after taking a break and coming back to this, I found that .toogle is the source of the problem, apparently this is being used within the admin. I changed the name to .toogleSection in my plugin and all is well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] my plugin is causing problem in the media uploader???’ is closed to new replies.
Skip to toolbar