If you are using this inside the loop of your WP_Query
then why are you providing the Post ID
parameter in functions. You don’t need to do that.
So your code will become this.
<?php echo '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>' . get_the_post_thumbnail( get_the_ID(), 'full' ); ?>
And please read the answer and explanation by @PieterGoosen. He well explained how WordPress functions usually works. And how can you echo the results with get_
prefix.
Also you were using \
before double quote which you don’t need to do here.
Related Posts:
- Using a custom WP_Query with get_template_part loop
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- WP_QUERY Get posts by category and similar name (Like)
- Using get_posts vs. WP_Query
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Is it possible to wrap Geo Location search around WP_Query?
- How to Access Global $multipage or Global $numpages outside the loop?
- What is an efficient way to query based on post_meta?
- Merging a complex query with post_rewind and splitting posts into two columns
- Pagination wont work with search results template [duplicate]
- Pagination Not working on Home Page with 2 Query
- WP_Query in a shortcode
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- Get all posts without tags
- Filter wp_query to search post title in function
- Two queries on the same page with pagination
- Sort by meta key on archive page
- Best approach to create Hot and Trending sections
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- SQL User Query by Multiple Roles using PHP
- how to speed up a complex wp_query?
- How to capture a variable query string, then append it to all URLs in a WordPress site
- Exhausted memory limit with very simple WP_Query
- WP_Query doesn’t get sticky post at the top, when used in a page template
- if/else on custom query gives 200 OK when condition not met?
- Creating arguments from loop for WP_Query meta_query
- Select from wp_post and multiple meta_value from wp_postmeta
- Multiple Loops Inside a Function
- Sort users by “birthday” using WP_User_Query
- How to use MySQL’s MATCH AGAINST in WP_Query?
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- only delete post within query / for each statement (front end)
- How to optimize multiple WP_Query() calls on one page?
- How to make “Blog pages show at most” setting not affect custom queries
- Make a page return false to is_single() and true for is_post_type_archive() before wp_enqueue_scripts
- category query for pages not working
- Bypass “supress_filters” in WP Query
- date_query on draft posts only
- How to get list of posts from permalinks?
- How to change main query to only query posts from a single category? [duplicate]
- Pagination for blog posts reloading same page [closed]
- wp_query not working with post_type
- Individual months in WP Query
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- Default permalink structure causing Notice: Undefined property: WP_Query::$post
- How to check the array values, what WP_Query has brought to me?
- How to Order a list of taxonomies? orderby?
- queried_object using pre_get_posts gets notices and warning
- post_parent don’t work and return 0 page
- date_query in pre_get_posts out of memory
- Combine 2 WP_queries into one (OR relation)
- WP_QUERY wrong ammount of posts
- How to add sort order to incremented and paginated category loop
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- Query only displays one page_id
- How to exclude a category name from showing?
- How to set parameters for search loop?
- Get posts with no tags?
- get_posts query matches too many results
- Sort by custom field that is an array?
- Get Post ID as a separate RSS feed item
- how to retrieve WP_Query without ordering by date [duplicate]
- Which is from this queries is more faster
- Start Query from 2nd Post without offset
- Related posts by current posts child category
- Trying to change category of wp_query
- Any quicker alternative for WP_Query “NOT IN”
- duplicated posts when using pagination
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- meta_query order by date present -> future then show null
- How to upload 3 attachments to current post?
- In a WordPress multisite configuration, how do I instruct WP_Query() to return posts from a sub-site?
- How to query for exact string in custom field?
- Multi line of $wpdb->query just run 1 time and end the loop right after
- Sort posts on custom field AND after that sort on date?
- Get last child of given page by ID
- display the children of the post using the current page as the main parent
- WP_Query for posts that have postmeta assigned to a taxonomy
- Paginated Author.php not using Author.php template
- Help displaying related categories
- A very strange problem with search query
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Custom Theme Building & Permalinks
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- wp_query – show pages that have parent defined
- previous_posts_link not working in WordPress pagination
- Eliminate typical pages on search page, turn it into ajax search with “infinite” sized single page
- Orderby Meta Value and Query from Meta Query
- WP Query to order posts by multiple meta fields
- Display First posts without the default featured image
- paginate_links() with Custom Taxonomy
- Parsing External Table Arguments
- query_posts, oderby meta_value & print “future” posts
- Query posts by meta value and sort by another meta key
- Output ACF field dynamicaly within a taxonomy loop [closed]
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Custom WP_query in Jnews theme returns thousands of posts
- Display post format post in the sidebar