0

I've recently started with wordpress theme development and have come up with a few different post templates but there's one thing I'm still unsure how to do - that is, having a post specific image appear before the post header, one that would be affected by css separate to that of the images found in the post body via attachments. Any suggestions would be appreciated.

1
  • Are you already using post thumbnails in this theme? Jul 25, 2013 at 8:13

2 Answers 2

1

You can simply use the featured image. Just output it where you want it to appear

<?php the_post_thumbnail( $size, $attr ); ?>

Use accordingly a class or a ID to style it with CSS.

Take a look there: https://codex.wordpress.org/Post_Thumbnails to abilitate the featured image in your theme.

0

You can accomplish this by using "Custom-Fields" within each post.

Essentially, you set a custom field and then style that field within CSS. When you make a post, you simply select which field you want and it will add that css to that specific post.

You can read a bit more about it here! http://wp.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/

1
  • Yes, you can do this like that, but you should not. WordPress has post thumbnails feature, which is much better in this case (it's exactly what idekman needs in fact). Jul 25, 2013 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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