How to create template in WordPress final

Posted on

let’s imagine that we want some sort of info box or disclaimer to sit right about here overon. the right side so in our code,we’ll go between the header and the content create a new section info box let’s create a heading level 4 that says disclaimer title and then just include a bit of dummy text okay so now let’s add some corresponding CSS so that this markup will sit right about here oops create a new comment infobox styles okay. so let’s add the code we’ll give it a width of about 30% float it to the right obviously. let’s give it a bit of margin so it doesn’t sit right up against the regular text okay let’s also give it a bit of padding and then a really light background color let’s also go ahead and adjust some of the text that sits inside the info box so remember we created a heading level 4.

I don’t really want there to be too much space below the header so margin bottom only 5 or 6 pixels and then let’s make the dummy text quite small so the paragraph text font size maybe 85% so if we refresh you can see that there’s now this nice little info box. we wanted this info box to also display on the terms and conditions and frequently asked questions’ pages all. we would need to do is head over to the dashboard find those two pages and adjust the template so frequently asked questions template special layout then we can do the same thing for terms and conditions okay so if we refresh there it is and if we go to terms and conditions there it is so this is useful because if you imagine you have maybe 10 or 20 pages and you want to include a uniform text box if you ever down the road make changes to this text now you don’t have to go to 20 different pages and update it. it’s just in this one easy to update template file so you can just change. it in one spot and that brings this third and final chapter of the lesson to a close let’s review what we learned today number one we can use conditional logic and if statement and then if that condition is met so if we’re on a certain page we can include unique code number two.

we learned how to create new theme files that match the slug name or the ID number of a page and WordPress will automatically make the connection to only use it for that page and number three. we learned how to create actual page templates that can be chosen from the WordPress admin screen so ,we’ve learned three different ways to send unique code to different pages so that brings this particular lesson to a close. thank you very much for Reading this I hope you feel like you learned something and stay tuned for more wordpress tutorials.

One thought on “How to create template in WordPress final

Leave a Reply

Your email address will not be published. Required fields are marked *