[resolved] my plugin is causing problem in the media uploader??? (3 posts)

  1. jwack
    Posted 6 years ago #

    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!

  2. jwack
    Posted 6 years ago #

    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('a.toggleLink').click(function() {
    		is_visible = !is_visible;
    		jQuery(this).html( (!is_visible) ? showText : hideText);
    		return false;
  3. jwack
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic