homepage – When to use hard-code vs template tags?

I am using Twenty-Twenty-One theme and want to create a separate home page (as it will be unique to all other pages in my website). I created a new file called front-page.php and it contains the template tags get_header and get_footer. I would like to add a banner image with some text (an h2 element) on top of it. I was thinking of using a div and then adding a background-image via CSS. My question comes regarding the title. Should I just hard-code this title, or should I use some kind of template tag?

I don’t think I should be using the template tag in this case (I don’t think there is a relevant template tag) but in my mind it is (though I don’t know if this is true) that the content should be as hard as possible in WordPress Don’t be coded. I guess a follow-up question to my first question is: When is it appropriate to hard-code stuff?

I’m relatively new to the theme file editor and child themes, so I may be misunderstanding or thinking things through.

Leave a Comment