Blog Archives

Using PHP variables in JavaScript with wp_localize_script

There is many ways to pass dynamic variables to JavaScript. An easy way would be just to define the JavaScript variables in the <head> echoing the PHP variables. This will of course work, but there is a WordPress-way to do

Tagged with: , , , ,
Posted in Intermediate

Use _n to write a phrase in single or plural form

If you would want to write a phrase in single or plural form depending on a number, there is a very handy function for it written in WordPress called _n. The function also takes a $domain argument which can be handy when

Tagged with: , , , , ,
Posted in Best Practices, Intermediate
About

WordPress Quick Tips is a blog supplying great tips about WordPress.

We hope to create a great knowledge resource for WordPress developers as well as serving a reminder for all the forgetful ones.

The blog is created and run by Vincent of Oakwood Creative

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 121 other subscribers