Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Home Redirect Banners
I'm facing a problem with the creation of a new site. In the hero section right after the header menu, I need to create a masonry of boxes with custom content that redirects to specific site pages. I need to avoid the owner of site to "destroy" divs and specific classes so I would not put it into the html editor of the home page. I want to create that section inside my home.php so the owner cannot modify it. The problem is how can I write page link into .php file without having to modify links everytime i move from local to live? It would be better if the link will be taken from the database so i could easily change it with sql queries
to better understand what i want to create i link you a image of the hero section
That is my second site on wordpress and I still need to understand a lot of things especially when I move sites from local to live.
Thank you so much guys!
Have a great day
Joel Bardsley31,246 Points
If you're absolutely certain the blocks will remain the same, and can ensure the page/post ids for these blocks would be the same between your local and live versions; instead of custom fields and a loop I'd suggest just echoing the permalink produced by the get_page_link function in your markup.
Hi Joel, thank you for your answer, from what I actually know, the blocks will remain always the same (position, content etc). So i need to create custom fields inside the page that I want to point to and then display them with a loop inside the container? I know how to do that for posts but for specific pages I cannot figure out how doin' it.
Thank you so much Joel for your precious tips, I have a lot of codex function's to learn and this one was exactly what I was lookin' for.
Have a nice day!