Building a website with WordPress provides great flexibility with what you can do in terms of both design and functionality. And, as you get deeper into theme development, you’ll find that there are times when you need to target a specific page, category or post type for something special. That’s where conditional logic can make your job much easier. Conditional logic is a powerful feature of programming languages (PHP, in our case). In essence, it means that we can use code to check if a certain condition exists and then do something specific if that condition is met. A simple example of this would be checking to see if a user is currently on our site’s home page. Using conditional logic, we might choose to load a slider or other special content in that situation.
With regards to WordPress, there are a number of useful Conditional Tags built into the software that let us test for all sorts of scenarios. They’re well-documented and allow you to bring a higher level of functionality to your site.
Today, we’ll take a look at a few of the more commonly used Conditional Tags and how you might implement them into your own site.
A Note on Using Condtional Tags
Source: https://managewp.org/articles/16996/how-to-add-conditional-logic-to-your-wordpress-theme
source https://williechiu40.wordpress.com/2018/01/26/how-to-add-conditional-logic-to-your-wordpress-theme/
No comments:
Post a Comment