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
- Creating a search form for custom fields
- How can I change the admin search posts fields?
- group search results by post type?
- 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?
- Include images from pages in wp search.php results in default wp search
- Backend search; include CPT meta?
- Custom Search | Wrong output & question
- Limit search form to 4 custom post types only
- Group search results by post type, but hide post types with no results
- 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?
- Include different loop templates in search query
- Search tags in CPTs
- How to search CPT’s by meta query from the admin dashboard?
- Set meta_query only for specific post type
- 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
- Including Custom Meta with posts_where query
- 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
- Including metaboxes from custom post types in global search — continued
- Custom post type not showing in search result
- Searching Custom Post Types
- How do i search authors from search form using author’s name
- BBPress Search results in WordPress search
- Set Custom Post Type in Widget Settings for use in Widget
- Displaying and searching Custom Posts
- Search by tag name and category
- Advanced search form with filters for custom taxonomies
- 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”
- Select2 AJAX and WP Query Returns ALL and does not filter
- search custom post type by custom fields on front end
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Custom Search | check multiple meta_value for search value
- Hide custom post type from search based on custom taxonomy
- Pagination on search results page
- Best way to create a search for custom post type by custom field values
- Searching post types
- Blank search results on custom search
- Limit search field to just search a custom post type with custom fields
- Display future posts in search
- Redirecting search to specific templates with $_GET[“post_type”]
- Search custom type post
- 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
- Creating a custom WP query for a Custom Post Type
- 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
- search results to show individual ACF fields from inside custom posts
- post_type incorrect for custom post type
- Live search by custom tag
- Custom search for a custom post type in WordPress
- how to create custom taxonomy drop downs for parents and child
- Search in multiple specific post types
- custom search form for custom post
- Custom post url in search.php isn’t the correct rewrited url
- 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
- Searching Custom Posts content with JQuery
- Custom Field Search
- WordPress search results grouped by post type
- How do I provide a search form for a specific post type, that is capable of searching within custom fields of the specified CPT?
- How to exclude html tags and class on search
- Multiple search forms and respective results page templates?
- Get a custom post type’s taxonomy type term names displayed as checkboxes and filter
- Exclude multiple custom post types from search
- How do I create a custom search function to only show contact information if they search for an exact unique identifier?