From the course: WordPress: Building Child Themes
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Conditional widgetized area - WordPress Tutorial
From the course: WordPress: Building Child Themes
Challenge: Conditional widgetized area
(upbeat music) - [Instructor] Earlier in this course, we completely removed the widgetized area. And even though I like the way it looks now that it's removed, it is a bit unusual to remove an entire branch of functionality from a theme. So what I want you to do now is conditionally add it back in, meaning, depending upon a condition, display the widgets on the front end. There are two main ways I'd look at solving this challenge: customize a template or write some PHP code. I actually tried both, and I strongly recommend customizing a template, since it's the most direct route. You'll also want to look through these conditional tags. These are a great starting place to know how to conditionally show content. What I want you to do is hide the widgetized area on regular pages and posts. But on pages that show a list of posts, like the blog page, go ahead and display the widgetized area. Good luck.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
- Ex_Files_WordPress_Building_Child_Themes_Starting_Site.zip
- Ex_Files_WordPress_Building_Child_Themes_2.zip
- Ex_Files_WordPress_Building_Child_Themes_3.zip
- Ex_Files_WordPress_Building_Child_Themes_4.zip
- Ex_Files_WordPress_Building_Child_Themes_5.zip
- Ex_Files_WordPress_Building_Child_Themes_6.zip
- Ex_Files_WordPress_Building_Child_Themes_7.zip