I’m making a site based on WordPress. It’s not going to seem a blog or WP. Just a website. So WP acts like backend where the client can edit the text blocks.
Question:
- How can I put block of text on my designed template wich users can edit from admin panel?
Let’s say something like this:
The 3 top blocks (about us, mission, why us…), how do you fill them from admin panel? Or specific text from header or footer.
Do I have to create 3 posts, and reference them on template through get_post($id)
?
Which is the best way to do it?
You have multiple options here, depending on the amount of flexibility you want to give the editor of the text blocks.
Create a custom loop with
WP_Query
. See our examples and the Codex page for usage. Then you print the excerpts of the page these boxes are linked to.You can use attachments (images) and the full formatting here.
Use widgets. See our examples and the Codex page. Limited formatting because the visual editor doesnât work too well in widget forms.
Use a custom navigation menu and print the description.
You can combine these methods: Use widgets for header and footer,
WP_Query
and page or post excerpts for the other boxes.My ten cents worth:
For singular, one time pieces of content on the home page you might consider using widgets. Register a “sidebar” in your functions file and then call that sidebar into your home template. Drag text widgets into that sidebar and voila.
For your feeds, use Posts or custom post types. Header and Footer really depend on what they’d contain.
I had to do a similar thing a few months ago on a WordPress build. The easiest way I found was to use a plugin called Spots.
Create a spot through the admin panel, add the content and then drop the ‘Spot’ tag into your code.
Another great way to do this would be with Advanced Custom Fields – creating an Options page and having a central location called Home (for example) where they could edit these blocks. If you use ACF, you can then also allow them to add just about anything there, with more control over formatting, like repeaters of images, text blocks, etc.
Adding to the nice answers of my colleagues, where you see
I’ll add that you have lots of Free Themes.
And many of them will provide an Options Page, where you can customize the look and content of many parts of the site (header and footer, for example).
There are Market Places where you’ll find themes completely packed with features. But that’s not necessarily a good thing. Contrary to what happens in WordPress.org, coding standards are not always followed by these themes. And sometimes this can bring severe headaches.
I believe the most famous is ThemeForest, and they recently have been taking steps to improve the quality of what is sold there.
Then you have the Theme Houses, like Woo, Elegant Themes, Graph Paper Press, to name a few, where the code is so well done as the aesthetics.
Then, Theme Frameworks. For which this article provides an overview.
Whatever you choose, stay away from shady Theme providers.