• Hi
    I want to get the image that was inserted as Highlight image in the cms.

    I have the following code

    $currentID = get_the_ID();
    $url = wp_get_attachment_url(get_post_thumbnail_id($currentID));

    This works in entire website but now that I tried to use it in the Homepage it doesn’t work.

    Any ideas??

    thanks

Viewing 1 replies (of 1 total)
  • in the Homepage

    are you using a static page as home page?

    if so, try:

    if( get_option('page_on_front') ) { $currentID = get_option('page_on_front'); } else { $currentID = get_the_ID(); }
    $url = wp_get_attachment_url(get_post_thumbnail_id($currentID));
Viewing 1 replies (of 1 total)
  • The topic ‘get_post_thumbnail_id’ is closed to new replies.