Get the URL of an image using Get The Image plugin

If you use Hybrid Core or any of the themes on Theme Hybrid, or use Get the Image as a standalone plugin, you’re probably familiar with how the function works, and thankful that Justin built it. I recently needed to get just the url of the image to add as a background via css. Here’s how to do it:

<?php $image = get_the_image( array( 'size' => 'full', 'format' => 'array' ) ); ?>
<?php if ( !empty( $image ) ) $url = $image['src']; ?>

<li style="background-image: url(<?php echo $url; ?>)">


alert(\”XSS Injection!\”)


alert(“XSS Injection!”)


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check out our Complete Website Package

Chat with us about your project or click below to find out more!

Learn More   Chat with us

Hi. We are Spigot. Telemarketers pronounce it Spy-got.

We are a Park City, Utah based web design shop that excels at building custom websites powered by WordPress and WooCommerce. We love content - content strategy, content curation, content soup...????Have a look around the site. As you browse you'll find useful navigation links in the sidebar on the left. We hope you find them useful anyway... Please let us know what you think, shoot us a message here.