11

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:

homepage wireframe

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?

3
  • Duplicate question by same user.
    – Steve
    Commented Nov 30, 2012 at 20:31
  • @Stephen No, the other question was a bunch of questions, I suggested to split those into separate questions. And that is exactly what the asker does here.
    – fuxia
    Commented Nov 30, 2012 at 20:46
  • "Duplicate question by same user" you say? Of course, toscho here closed it... what else? And as he says, you know why now. Commented Dec 1, 2012 at 9:47

6 Answers 6

6

You have multiple options here, depending on the amount of flexibility you want to give the editor of the text blocks.

  1. 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.

  2. Use widgets. See our examples and the Codex page. Limited formatting because the visual editor doesn’t work too well in widget forms.

  3. 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.

5
  • I think I'm going to give you the check of rightness. Just because you fulfill the others parts and summarize'em. What about i18n here? Any problem? And for the "1." you recommend to use POSTS or PAGES? And specific page/post for this text excerpt, or an entire "About Us" page/post with all content and printting on home only specific part of this full page? Commented Dec 1, 2012 at 10:51
  • Oh and for the "1." solution, what if client deletes a post/page that you used to link the text excerpt from Admin Panel? Cause you basically modify WP_Query to i.e. post_id=3, no? Commented Dec 1, 2012 at 11:04
  • Ask for specific post meta key, or for titles or authors. But do not ask for post IDs, they can change anytime. And if there are no posts, just don’t show anything. The client should be able to control what content is displayed and what not.
    – fuxia
    Commented Dec 1, 2012 at 11:08
  • So you suggest to create a POST called "About Us", and on the theme, modify WP_Query via post_title = "About Us" (or something like that) and print the_content() on this DIV, no? Then I could have the About Us PAGE, and create a link to it, i.e. on a navbar? I've seen how to do it via widget too, as you shown me on the answer. I can extend Widget class to somthing basically being a textarea with a title... but no rich text here, and a bit complicated to use and even implement... no? Commented Dec 1, 2012 at 11:16
  • Yes, yes, yes, no, yes, maybe, no. As you can see, stuffing a lot of new questions into comments just doesn’t work very well. :) Follow the links, ask new questions when you get stuck.
    – fuxia
    Commented Dec 1, 2012 at 11:52
3

My ten cents worth:

  • if your page editor has admin access and can edit widgets, then you can create a widget zone for each of those items and provide an appropriate widget for each
  • if your page editor doesn't have admin access, e.g. they have role editor or author, then they won't be able to edit the widgets to update them; use custom fields on the page. You can use plain old custom fields for that, or drop in the Advanced Custom Fields plugin.
1
  • Really a nice one answer. Commented Dec 1, 2012 at 10:50
2

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.

1
  • I like yours too, cause basically explains how to use the widgets (which suggestion was provided by others but not on how to do it) and specifically extend it with feeds part! Nice! Commented Dec 1, 2012 at 10:56
1

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.

Description
Content manage those little snippets of text that you need across your WordPress site and in widgets properly. Forget the text widget.

Create a spot through the admin panel, add the content and then drop the 'Spot' tag into your code.

1
  • This is a really awesome solution too! And really tempting me. What about i18n here? Commented Dec 1, 2012 at 10:57
1

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.

1
  • An extension of first answer and really good too. Commented Dec 1, 2012 at 10:57
0

Adding to the nice answers of my colleagues, where you see

  • the importance of the Widgets
  • the extensive documentation in the Codex
  • the use of free Plugins to make tasks easier and add functionality to your site
  • using this Stack as source of in-depth information

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.

1
  • Nice answer. Thanks. What about blank template called Starkers? Is it trustable? Commented Dec 1, 2012 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.