[Resolved] Custom post class on posts with featured videos?
I’m doing some overly fancy PHP work with my featured images/videos, I don’t use default tags giving you an <img> I’m using this:
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <?php endif; ?> <div class="overlayImg" style="background-image: url('<?php echo $image; ?>')"> </div>
To give me a div with the image as a background, I realize I can’t put a video as a div’s background, instead I want to do some custom stuff on posts with featured videos, problem is that there is no way to tell which posts have it and which don’t using this plugin without using wonky after the fact JS or me editing the plugin, which I don’t feel confident/competent/comfortable doing.
Adding a custom class to posts that have a featured video would greatly help, and something like “has_post_thumbnail” but for videos would also be useful to allow me to pick video/picture in the PHP.
- The topic ‘[Resolved] Custom post class on posts with featured videos?’ is closed to new replies.