Hi I'm using ACF or Advanced Custom Fields which i saw here a while ago..

What i want is to output a second featured image in the homepage..

Question: 1

<div class="jpl-widgets-d" style="background: url('<?php the_field('featured_home_page_image'); ?>') no-repeat;">

<?php the_field('featured_home_page_image'); ?> = URL OF THE IMAGE The ACF should output the URL of the image i uploaded..

Here's the plugin documentation LINK

Field Name: featured_home_page_image Field type: Image Return Value: URL

Help. thanks!

  • Have you already checked their support forums? If so: Please add a link on both ends. – kaiser Aug 14 '13 at 19:29
  • Not yet, i thought posting here would be faster... – Jeremi Liwanag Aug 14 '13 at 19:41
  • Give it try there as well. And add a link, maybe that helps solving it faster as reputation comes into the game. – kaiser Aug 14 '13 at 19:45
  • Ok, Unfortunately im working locally.. If they need more code i'll give it .. – Jeremi Liwanag Aug 14 '13 at 19:55
  • You are showing us the code, but not the result. What is in the src attribute or the style attribute after you run the code. Look at the page source. Never write "it's not working" in a question. Tell what is happening or not happening. – Charles Clarkson Aug 14 '13 at 20:45

I have this exact thing working on a current project.

Here's the code:

<div class="photo-feature" style="background: url(<?php the_field('the-image', $page->ID) ;?>) no-repeat center center; "></div>

Keep in mind a couple of things:

  1. You may need to use $post->ID or $page->ID if you're using a custom query.
  2. Make sure you're not overriding your background CSS anywhere else (use inspector to double check)

Finally - you should take the single quotes out of your inline CSS.

style: url(path) not style: url('path')

  • I'm trying to output it in my static front page ... i followed your code , still no luck. <div class="jpl-widgets-d" style="background-image: url(<?php the_field('featuredimg_url', $page->ID); ?>) no-repeat;"> – Jeremi Liwanag Aug 15 '13 at 8:52
  • i changed the field name into 'featuredimg_url' – Jeremi Liwanag Aug 15 '13 at 8:56
  • the image is coming from a different page .. and show it on my homepage .. – Jeremi Liwanag Aug 15 '13 at 10:18
  • Are you getting other page content from that page? Can you edit your question and include your custom query? – timshutes Aug 15 '13 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.