Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I never used custom fields so I got a bit exited.

I'm not sure if I'm overusing them:

enter image description here

enter image description here

(I'm using them to display the title of images and images themselves. (big and small ones).

I used to do it with custom post types but it didn't make sense since those images belong only to that single posts.

Any suggestions?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

With the limited view we can see of how you're using the custom fields, I don't think you're over-using them. However, I would try to clean things up a bit. "Featured Image" and "Featured Title" obviously are related to the same image. So are "Main Left Image" and "Main Left Title."

Rather than using public custom fields for these, I'd use private custom fields and a custom meta box to hold everything. This will clean things up quite a bit, make the post page seem less cluttered, and give you a clearer link between the related custom fields.

Private Custom Fields

The difference between private and public custom fields is the name. Prefix the name of a custom field with an underscore and it becomes "private." This means it doesn't show up in the list of custom fields for a post unless you tell it to, but you can still create it and read it back using the same add_post_meta() and get_post_meta() functions.

Custom Meta Box

All of the editable boxes in WordPress (title, post content, publication data, categories, etc) are meta boxes. You can create your own that identifies the specific custom fields you're using and sets them as appropriate

If you look around a bit, you'll find some great tutorials and instructions for how to add custom meta boxes:

share|improve this answer

I think that attachments would be perfect in this case. Here's a good overview.

share|improve this answer

What's wrong with using the built-in post attachments

$args = array(
    'post_type' => 'attachment',
    'numberposts' => null,
    'post_status' => null,
    'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
    foreach ($attachments as $attachment) {
        echo apply_filters('the_title', $attachment->post_title);
        the_attachment_link($attachment->ID, false);
    }
}

You can get the same results and not overload your postmeta table.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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