You can turn your snippet into a function that returns the post thumbnail URL of a post:
function wpse81577_get_small_thumb_url( $post_id ) {
$thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'small' );
return $thumbSmall['0'];
}
Usage, supplying the ID of a post:
<?php echo wpse81577_get_small_thumb_url( 59 ); ?>
Related Posts:
- How to set global variable in functions.php
- How to get CGI variables?
- Extracting a variable from a permalink
- How to make url variable?
- Custom plugin route in WordPress
- Why is ?doing_wp_cron being appended to my URLs
- use query string in URL to display content on the page
- Change default URL path (/blog/) of blog posts
- How to deal with WordPress on localhost
- How to convert the file path to a URL of the same file?
- Why is WordPress saving full-urls to the database?
- Get taxonomy slug from url
- Load images with http urls inside https post
- Change logo url link
- List of default WordPress URLs
- add_query_arg() One Key with multiple values
- As soon as I add a custom query_var using the filter, my pages point to an archive page – why?
- How to update media links in WordPress after migration?
- How can I change all links on pages to point to a different domain from where the site is hosted?
- Remove site root trailing slash
- Why ids in urls don’t work but slugs do?
- Remove / from www.example.com/ [closed]
- How to create a page for authors? like www.myblog.com/author/
- Old URL Redirect website after migration
- Check request URL for pattern
- Best way to give site sub-page it’s own domain?
- Dynamically change page title from URL param
- Rewrite WordPress Standard Feed URL – /feed/ to feed.xml
- wp_insert_post – How do I prevent incremental numbers on child pages?
- Result of API Request to global variable?
- Getting 404 Hits on URI -/-/-/-/-/-/-/-/-/- . How to deal
- How to change logo url [closed]
- Dynamic URL based on user_metadata
- Check if user is logged in to site A when visiting site B
- Make homepage a non-WordPress page
- How to modify a global variable in a function and use it on another function?
- Localhost port is missing on some links after downgrading MAMP [closed]
- Avoid the removal of “https:” from URLs
- Content duplication issue with dynamic URLs
- Why am I seeing all these weird ‘loginid’ requests?
- Confusion about Site url and directory
- Is get_permalink also the canonical URL?
- Remove trailing slash from previous_posts_link()
- Moved WP into new folder. How to fix image links in posts?
- Will get_bloginfo(‘url’) return URL with backslash?
- How to parse a custom url (within WP site) and obtain params passed to that URL
- What does the Global Variable $s represent?
- Get current page id, title, url, etc
- How can I identify which file/function will be used to respond to a particular URL?
- Is there a way to test if a URL is part of the current blog?
- Could not find the wordpress page
- Multiple duplicate URL’s
- An anchor name (id name) in the address bar
- Dynamic URL and pass the data to an iframe
- DNS – Change WordPress Site Name?
- get_template_directory() returns wrong address on VPS
- how to load posts to a custom post template after using template_redirect or template_include
- Unnecessary url
- Finding URI in Child Theme
- Make custom system url
- Image not showing up in media loader success area – followup
- How do I allow http/ftp access to files I have uploaded?
- Redirecting URL with Twitter Button API Not Working
- Need help changing back the correct wordpress url
- Adding Parent Categories and keep current URLs
- Sanitizing URL in a WordPress plugin
- Pass global variable from Page 1 to page 2 (Pagination)
- How to get a page url segment on wordpress?
- Different url to same page (with dynamic content)
- WordPress option com_jce should not work
- Too many redirects (ERR_TOO_MANY_REDIRECTS) only on one page
- How to create a user ability to save pages with full url?
- WordPress Still Requesting Old Url
- Broken Images and Style
- Add more than one query parameter onto wordpress url
- Allow duplicate slugs for pages and posts
- How to access custom class methods from any include without using global
- i1.wp.com url problem (Jetpack not installed)
- Change dynamically URL to SEO friendly via .htaccess?
- incorrect url in Snippet editor
- I need some explanation on global $post [duplicate]
- Get userdata from url
- WordPress dynamic subpage for ACF
- From whence %E2%80%8E at the end of post link
- WordPress Address (URL) Reverts back
- Modify the WordPress URL
- Duplicate pages with ?s parameter
- Editing Global Variables from Inside Functions
- How to pass REQUEST_URI to function
- Populate Website URL at registration time
- WordPress Update Links
- wordpress url with format .com/category/sub-category
- Get gallery url (Nextgen) [closed]
- How to use query string in URL to display content on the wordpress page
- help me remove this additional parameter in url
- Function to get custom post image URL
- How to echo a dynamic url
- How to run Wiki on the same host as WordPress and not get 404 errors when browsing to Wiki?
- What purpose does /embed/ URL have and how to avoid SEO problems?
- How can one use variables in a template or template part without polluting the global scope?