Welcome to the Treehouse Community
Looking to learn something new?
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,242 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!