Setting secondary image as element background
-
How do I set the secondary image as the background of an element? I’ve got my secondary image setup but can’t get the ‘get_post_thumbnail_url’ code to work. My code is this:
<a class="thumbOverlay" style="background-image:url('<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::get_post_thumbnail_url(get_post_type('MY-CPT'), 'secondary-image'); endif; ?>');" href="<?php echo the_permalink(); ?>"></a>
The html is outputting thus:
<a class="thumbOverlay" style="background-image: url(http://URL-OF-MY-PAGE/); " href="MY-PERMALINK"></a>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Setting secondary image as element background’ is closed to new replies.