Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm learning how to write a plugin. My plugin is a google map that places markers based on the selected criteria. It works fine. The problem is that it interferes with one part of the theme I'm using. The theme is called Superb. The theme has a uBillboard, basically, it's a slider. For some reason, my plugin prevents the uBillboard from appearing-- the first maybe 30 pixels of the image are visible.

I'm not sure where to begin in order to debug this. What should I be looking for? What are common reasons for plugins interfering with themes? I can post code, but I don't think that it makes sense to post the whole theme and my plugin.

Thank you.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The most common problem are JavaScript conflicts, you can debug this by making sure you are using no conflict wrappers. Another thing you can adjust is the load order, sometimes there are errors when one script is loader before/after another. If you are relying on many 3rd party scripts it can be difficult, you might have to completely re-do some functionality.

Also check to see if there are any CSS selectors clashing, make sure all the CSS the JavaScript references is unique and separate. Google chrome's inspect element is a great tool to debug and step through JavaScript.

share|improve this answer
    
Hi @Wyck, Thank you for your message. My pal, Miro, suggested that I comment out all of the js, and then uncomment it bit by bit to figure out which line caused the problem. I've traced it to this line in the js: google.maps.event.addListener(csf_map, 'tilesloaded', csf_map_viewport_bounds); . This event listener calls the csf_map_viewport_bounds function after the Google Map tiles have loaded. The function checks the lat long coordinates of the map. I'm not sure why this line is causing problem. It could be the function it calls, but I don't see anything weird. Any suggestions? –  Laxmidi Nov 13 '11 at 5:32
    
The line reading: google.maps.event.addListener(csf_dcscore_crime_map, 'tilesloaded', csf_dcscore_crime_map_viewport_bounds); isn't ina function. It's simply in the jQuery(document).ready(function() { }); -- not sure if that would make any difference. –  Laxmidi Nov 13 '11 at 5:35
    
Also, I tried commenting out all of the code in csf_map_viewport_bounds(), and uncommenting the event listener: google.maps.event.addListener(csf_dcscore_crime_map, 'tilesloaded', csf_dcscore_crime_map_viewport_bounds); So, I know that the problem is with the eventListener, not with the function. –  Laxmidi Nov 13 '11 at 5:37
    
Well it is unlikely you can change the google script, and I would assume it is written properly, instead I would comment out other scripts being loaded 1 by 1, then comment out the lines in the plugin, are there no errors in the debug console? –  Wyck Nov 13 '11 at 5:38
    
I took the Google Maps event listener out. Now, I call the function that calculates the map bounds when the button is clicked. I then chained the functions together so that one function calls the others. It's not as efficient as when the event listener called the functions after the map tiles loaded, but it works. –  Laxmidi Nov 13 '11 at 17:34
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.