the_permalink() and the_post_thumbnail() echo their output. Use the "get_* version of those functions, get_the_permalink() and get_the_post_thumbnail() when concatenating a string to be output.
Both the_post_thumbnail() and get_the_post_thumbnail() will echo/return <img> tags so don’t wrap their output in an <img> tag because it’s already taken care of by those functions.
The original HTML posted is missing quotes and I’m not sure why you have the <head>, <style>, and <body> tags in there; those tags are not necessary.
This code will output a linked image:
<?php
echo '<a href="' . get_the_permalink() . '" target="_blank">' .
get_the_post_thumbnail( get_the_ID(), 'video' ) . '</a>';
?>
Related Posts:
- WP_Query create html structure
- Display posts side by side with custom query
- Is there a way to control both Order By and Order query parameters from one input field
- How to increase load time of an archive/search page (WP_Query)
- Problem with is_tax in WP_Query loop
- Removing duplicate values between two wordpress queries
- Issue with front page navigation after upgrading to 3.4
- empty WP_Query object on local install
- Ordering posts by an array
- Prevent author bio page from showing in search results
- Changing the default wp_search_stopwords
- Exclude recently updated post from custom WP_Query using multiple loops
- get_posts output always same post
- WordPress Custom Search Form Displaying Unexpected Results
- WP_Query array key / value pairs?
- Get posts from multiple tax terms
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Tax Query only returns for the first of several terms
- Limit number of posts in loop
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- Appending to existing WP_Query’s meta_query if exists
- WP_Query offset is returning post from prevois loop
- Tax query is not working!
- How To Keep Search Title the same on paged Results
- Does WP_Query ‘responds’ badly to empty arguments?
- Remove post type filter added by the plugin in the final query
- How to get more data of a post by wp_query
- How to restrict search on a certain page to only return results against custom taxonomies?
- pass parameters through variable to WP_QUERY
- What is wrong with my WP_Query Arguments?
- Query of all pages, including children, ordered by meta key
- Can’t order the query result as given posts id’s array
- specific post is not excluded from the loop
- Unable to paginate a custom page query
- How to change the default post type over the loop?
- Trouble Making WP_Query paged
- How to WP Query custom multiple custom taxonomies?
- Sort posts using multiple custom fields and menu_order in single query?
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- Generate custom output on URL with directory
- prevent get_comments() from returning comments not in comment__in
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- How to make WPQuery custom post type work in Twig / Timber
- Display posts from multiple value in meta separated by comma
- WooCommerce. How To Exclude Subcategory Products From Category Listing Page
- IF ( ! $loop->have_posts() ) condition doesn’t work – WP_Query
- get_posts return only first result
- How to allow a variable with “/” in wordpress url
- Getting posts by custom field value
- How to get taxonomy image attached to a Post Type WordPress
- How to display a post(by id) along with css in a page?
- search multiple keywords with wp_query using one query
- Order posts by tags count?
- Show one post of each custom taxonomy
- wordpress multiple meta value query is not working
- trying to change from query_post to WP_Query
- Strange results from WP_Query
- update_post_meta performance in a loop woocommerce
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- return child post if available otherwise parent post
- Custom Order Current Query: By Meta Key and Category
- Search has query that will return no results
- remove_action – pre_get_posts – does not restore original query
- Order Posts By Custom Field That is an array of objects
- WP_Query doesn’t work when url parameter is added
- why ignore_sticky_posts in sticky post query
- How to define a custom hierarchy for terms?
- WP_User_Query not searching numbers?
- Woocommerce orderby rand with tax_query not random
- Select Unique Posts for a List of Tags
- How to modify WP Query to target the first most recent post to adjust content
- Some doubts about how the main query and the custom query works in this custom theme?
- orderby in WP_QUERY – Use the order from the Dashboard
- Use not custom fields in get_posts() meta_query?
- WP_Query always returning the last custom post
- Trying to Exclude Sticky Posts From date_query
- Load 3 posts in flexslider slide [closed]
- why is this query returning entire blog-posts
- Pagination error WordPress multiple loop
- Multiple wp_query loops showing first 5 posts on all pages instead of older posts[Resolved]
- get_posts works but new wp_query doesn’t
- Pagination With Custom WP Query not functioning
- SQL returned by Wp_Query has wp_posts.ID = -1
- $query conflicting with other queries in the same page
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- How to sort by post_date and meta_value_num?
- get_posts shows current post, not defined posts with args
- Filter posts by category
- Prevent WordPress loop from displaying similar post titles
- wp_query order by rand is repeating posts
- Group By query based on Custom Field
- Limit paginated result set to a maximum number of posts
- Custom query with custom filtering returning incorrect results
- Best performance for use Custom Field in WP
- How to get post taxonomy url and name in wp_query
- Wp_query to get woocomerce product categorys [closed]
- Modify WordPress Search
- $wp_query->found_posts; returns zero
- Exclude page ID AND current page from wp_query of a Parent page