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.

Are there any WordPress specific Javascript functions that could be used as helpers when writing custom code?

I am thinking specifically of one that would pull back the base URL of your install, but any helper functions built into WordPress would be nice to know.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

WordPress installs with a number of libraries/classes/plugins/etc that you can enqueue and use.

For base url specifically, or any vars in general you need to access from javascript, use the api php functions, then pass it to your javascript via wp_localize_script.

share|improve this answer
3  
+1 for encouragement of wp_localize_script. One of the most underappreciated and used WP techniques. –  tollmanz Aug 22 '11 at 15:18
add 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.