Knowing how to write WordPress if statements can help you take your websites to the next level. They are meant to pose a question and based on the answer to that question you can do or show something. This can be a really powerful tool in your development work belt, especially with the conditional tags WordPress already has built into the core. In this tutorial, I am going to give you the basics of WordPress if statements and provide a few real world examples.
In my last post we discussed how to harness the power of JQuery in WordPress. What if you want to use the dollar sign in WordPress instead of jQuery? In this article I would like to show you how to properly mark up your JQuery, when to tell your script to run, and a quick tip on how to make the $() work instead of having to write out jQuery() in complicated functions.
The code example below shows you how to correctly start and end any scripts that you write. You begin with <script> and end with </script> just like a div. Then it is good practice to add any JQuery calls inside of an anonymous function as seen below: