Support » Fixing WordPress » inserting media into post and then making it a background of some div?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @hladdha, sounds doable but I’m a little fuzzy on details:

    When you say ‘defining the class with the background manually,’ do you mean in the CSS? In that case, wouldn’t the images be uploaded in advance as part of your /images/ folder in the theme?

    If you preset your different classes to correspond with different images, you wouldn’t have to upload new images by post, you could just have a custom field that allows you to select a class name.

    OR, is it necessary to be able to upload new images on a post-by-post basis?

    yeah, thats what I am doing currently, defining classes manually, uploading the images before and setting the custom field in the post for classname ( above the custom fields name is “bgImageClass” ) so I wanted some alternative to this where I can upload and use on post by post basis

    You can upload the file to your media library, copy the url, and use that as the value for a custom field instead of assigning the background by selecting a class.

    However, you’d need to a) set the background image value as inline css (or in your header) in your template, or b) you’d have to rewrite your template so that the image is behind your content as an image, not a div with a background.

    By the way, if you’re using custom images like this regularly, you can make the upload + assign value process even easier by using the Advanced Custom Fields plugin as well, which allows users browse-and-upload functionality right from the edit page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘inserting media into post and then making it a background of some div?’ is closed to new replies.