0

I use this line:

echo (the_user_favorites_list($user_id = um_profile_id(), $site_id = null, $include_links = true, $filters = null, $post_thumbnail_id = get_post_thumbnail_id()));

to display a user's favorites but only the link to the post is displayed. I thought:

$post_thumbnail_id = get_post_thumbnail_id()

would also display the thumbnail picture but it's not the case. How should I modify this to have:

*Post1 title link*
*Thumbnail1* 

*Post2 title link*
*Thumbnail2* 

Here is the code:

function get_user_favorites_list($user_id = null, $site_id = null, $include_links = false, $filters = null, $include_button = false)
{
    global $blog_id;
    $site_id = ( is_multisite() && is_null($site_id) ) ? $blog_id : $site_id;
    if ( !is_multisite() ) $site_id = 1;
    $favorites = new UserFavorites($user_id, $site_id, $include_links, $filters);
    return $favorites->getFavoritesList($include_button);
}

function the_user_favorites_list($user_id = null, $site_id = null, $include_links = false, $filters = null, $include_button = false)
{
    echo get_user_favorites_list($user_id, $site_id, $include_links, $filters, $include_button);
}

Thanks for your help

2
  • the_user_favorites_list is not a core function, so without seeing the code behind that function it's impossible to say how to fix it. – vancoder Aug 25 '15 at 22:28
  • @vancoder I edited the code, thanks for taking the time to answer. – Graham Slick Aug 26 '15 at 0:09
1

get_post_thumbnail_id() only returns the ID of the thumbnail. To get the actual thumbnail you could instead use get_the_post_thumbnail()

You can also get the image using it´s ID, but that requires wp_get_attachment_image( get_post_thumbnail_id(), 'full' )

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.