No need to be that complex, you can use the has_post_thumbnail function
<?php if(has_post_thumbnail()): ?>
<a href="https://wordpress.stackexchange.com/questions/35217/<?php the_permalink(); ?>"><img src="<?php bloginfo(url); ?><?php echo get_post_meta($post->ID, 'featured-image-large', true); ?>" title="<?php echo get_post_meta($post->ID, 'featured-image-title', true); ?>" /></a>
<?php endif; ?>
et voila! =)
Related Posts:
- How to create a custom search for custom post type?
- Extending the search context in the admin list post screen
- Include custom taxonomy term in search
- Creating a search form for custom fields
- Searching multiple custom post types and pages
- How can I change the admin search posts fields?
- group search results by post type?
- Development of a WordPress Search Plugin – Best Practices
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Simple way to search custom-post types only
- Custom post type admin search
- Using standard search function with custom post type
- The right way to create a custom search page for complex custom post types
- Search everything (posts, pages, tags, cpt, meta)
- Search Custom Post Type with all meta attached?
- filter search result with custom post type meta key
- Custom search for custom post type, custom meta and search fields
- Limit search form to 4 custom post types only
- Search results ordered by custom post types are not grouped
- Search Post Title Only [duplicate]
- How can I include meta box content when searching?
- Customize Search to only search current custom post type
- How to search from specific post type with tags?
- How to search CPT’s by meta query from the admin dashboard?
- multiple search forms and search results
- Custom Fields vs Separate Table
- Add custom post type archives to search results?
- CPT Meta Searching
- How to filter search results by post type?
- How to create an advanced filter search?
- How to search map address in custom post type?
- Custom search results page query, link permalink to post title while separating by post types
- Custom Search for Drafts in Custom Post Type
- Multiple meta_values in the pre_get_posts filter?
- How to order separated Custom Post Search results
- search also in taxonomy, tags and custom fields
- Custom post type search using $_SESSION and pre_get_posts
- Custom Post Type And “fopen”
- Filter custom posts using auto populated dropdown selectors
- Make parts of your wordpress website completely built with data from external APIs?
- Including metaboxes from custom post types in global search — continued
- Custom post type not showing in search result
- What to and how to proceed with CPT to make DB small and efficient?
- Auto Complete Search
- Remotely search WordPress sites using xml-rpc
- BBPress Search results in WordPress search
- Limit Search to Post Type With Apostrophe return search not found
- Search filter triggered & sort by custom post type
- Set Custom Post Type in Widget Settings for use in Widget
- Displaying and searching Custom Posts
- Search by tag name and category
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Different results between permalink and query var search
- How to let users choose where to search for posts?
- WordPress Custom Search by post_type
- What content types are shown at a search page?
- Search one custom post type ONLY, disable “all posts”
- Pagination Error : Duplicate argument being outputted
- Custom Empty Results page for my Custom Post Type
- Select2 AJAX and WP Query Returns ALL and does not filter
- search custom post type by custom fields on front end
- Custom Search | check multiple meta_value for search value
- Searching post types
- Blank search results on custom search
- Limit search field to just search a custom post type with custom fields
- Building a Data Intensive Website with WordPress
- Display future posts in search
- Redirecting search to specific templates with $_GET[“post_type”]
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Is it possible to get the specific content on the search page?
- Search for custom field input of a custom post type in ajax live search
- In the php, how can I have a category of a custom post type display?
- Search Function not searching correct custom_post_type even though post_type is defined in search args
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Custom search for a custom post type in WordPress
- Advanced search form with multiple custom fields
- Search in multiple specific post types
- I can not display search template created from a post type custom
- Creating a search results page from a custom post type in a plugin?
- Search custom post type result in same template page
- Search facility with directories
- Create Second Search Page Only for Custom Post Type
- custom search form for custom post
- Custom post url in search.php isn’t the correct rewrited url
- Conditional posts in WP_query for search
- Manually build WP_Query
- Extensive search filtering and results->PDF in the front-end
- Trying to modify custom search function in plugin to search postmeta table for keyword as well as posts table
- pre_get_posts not firing at all
- Custom post type blog pagination conflict
- Diffrent search templates for different post types
- Advanced search form with filters for custom taxonomies and custom fields
- Problem with custom post type search
- Searching for a single custom post type, buddypress
- admin search of pages returns custom post types
- WordPress search results
- Drop Down Filter with CPT as Options for Search Form
- Custom Field Search
- WordPress search results grouped by post type
- Group search results by post type, but having a unique heading for each section?