0

I want to make, I guess a custom field for my theme. I'm not sure is it the right way to do this with custom fields.

I searched a lot, but could not find what I need. So I'm hoping that some one could give some pointers or links, since I dont know what exactly to search for my case.

What I want to make is to add below post title bolded intro for the post. I know I could do this by the post, but I am making a design where this would be separated.

Like

  1. title
  2. description / bolded intro for post
  3. Author/ social button
  4. Post

So you can see why I need it separately.

Any pointers?

1 Answer 1

1

Yes, you'll want to create custom metaboxes for those. This is a pretty good intro into how to do that. But you might want to think through a few things:

  1. Are you sure you want that added to ALL posts? If not, perhaps create a custom post type and attach those fields to that post type instead.
  2. Maybe you really DO want it on Posts and not a Custom Post Type, but is it necessary for ALL posts? If not, you might want to add some custom javascript to conditionally add those fields if the user wants to do that kind of post. While this script is for page template, it could easily be applied to a post instead.
  3. I find it easiest to start with a Custom Meta Box library. WebDevStudios has a really great and regularly updated library to try out.

Good luck!

4
  • Hi Matt. Well i want to have like a default field in post so when something is written inside it will be shown. Thank you for this, now i know where to start. Regards
    – Max
    Commented Dec 14, 2014 at 12:45
  • Update. First link does exactly what i needed.So that was BINGO :D The only thing that remains is, i dont know what part from that code i have to copy/paste inside single-post.php so it would be shown exactly where i want it. Currently is shown inside post on top, which i can achieve without it. Perhaps you know this ? @MattCromwell
    – Max
    Commented Dec 14, 2014 at 13:30
  • Glad the link helped. There's a million ways to integrate custom fields into your template files, but those articles and a bit of Googling for get_post_meta() should get you there. Would appreciate marking my answer as the approved answer and an upvote ;-) Commented Dec 16, 2014 at 7:41
  • @Max You should revisit this post and accept this answer as it solved your issue Commented Oct 22, 2015 at 4:27

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.