Why does my thumbnail turn blue?

How do I turn a post thumbnail into a background image?

  • I believe the answer o this question was http://wordpress.org/support/topic/post-thumbnail-as-background, but it is still not clear to me. The snippets are scattered all over the discussion and several glitches happen when I implement them.

  • Answer:

    I was looking for a code snippet that will extract the URL of a post thumbnail to be used as a background image. Through research elsewhere, the best answer I found is the code snippet below: <div style="background: url(<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'large', true); echo $image_url[0]; ?>)"></div> This code sets the large thumbnail of a post as the background image in this div tag. From here I believe you should be able to modify this code to your particular situation.

harrypujols at WordPress Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.