- This topic has 4 replies, 3 voices, and was last updated 10 years ago by .
- The forum ‘General Discussion’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Tagged: custom template
I am trying to do something which should be drop-dead simple and is apparently insanely complicated.
I want to create a page template which:
- displays some text that I added to a page via the dashboard; and,
- displays the titles of each blog post
In other words, the page is a list of post titles with some introductory/framing text.
I am fine with writing PHP code to accomplish this (it's what I've been doing for the last couple of days trying to implement this idea).
Surely this is a solved problem. I can't be the first WordPress author who wants to wrap some context around a set of posts? So if anyone has any links for me to read I'd love to get them.
It might be easiest to add a widget area to display at the top of the blog page - that way you can drop in your content and the blog posts will show up underneath.
Thanks, Andrea. I considered that but didn't pursue it because it looked like more work than what I eventually did. Which basically was to include the static text in the custom template file as HTML markup.
It feels very wrong to include content in what amounts to a code file, but it worked. I may take a shot at using the widget area approach when the dust settles, because it would be nice to be able to use the dashboard page editing capability to change the introductory text. Rather than having to fire up a console to edit a code file.
Technically, that's not much different than including a widget in the template. In one, you'd have to edit the template to add your hand-rolled HTML, in the other, you'd be updating your hand-rolled HTML in the text widget you added.
I've created page templates that included paragraphs of intro, and even some that displayed a banner splash (that the end user could manage by changing the page's featured image).
So what you didn't isn't "wrong"... it's just a matter of persepective on where you put your code!
Good point. My MVC background is showing :).
© 2023 WPEngine, Inc.