The solution is simple, don’t echo
the result of that function, there is no result to echo.
echo the_post_thumbnail(array(155,55));
Is equivalent to something like this:
echo '';
the_post_thumbnail(array(155,55));
Functions that begin with the_
in WP don’t return things, they output things. Some of them let you pass a parameter that lets them return instead, but those are the exception, also don’t do that.
The echo
is both unnecessary, and incorrect PHP.
So, just use this:
the_post_thumbnail([ 155, 55 ]);
Notice I also swapped the old style array syntax for modern array syntax, and spaced out the parameters.
Related Posts:
- Prevent publishing the post before setting a featured image?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Redirect to another page using contact form 7? [closed]
- Add_image_size not generating correct size
- Update (a function) post’s featured image as soon as $image_url changes
- Display Video as Post Thumbnail
- Disable plugin / plugin action via theme
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- Need to create a Theme demo site that features multiple themes
- Define Function in functions.php or plugin and call in theme loop
- Autogenerate wordpress shortcodes using array?
- Why does including a file in theme’s functions.php not work?
- WooCommerce create new product and add to cart on form submit
- Adding New Role
- Shortcode under a Shortcode Multiple times Possible?
- Add Top-Level Menu that opens URL
- wordpress custom login successful redirect hook
- WordPress ajax call for not logged in users, doesn’t work
- Display All Non-Used Plugins
- Override plugin functions in functions.php
- New Plugin: Post update pushes a copy as a revision
- Placement of Code in Plugin for hooking `save_post`
- Display a text message if the field is not found and not if found
- Add get_option to jquery
- Add a plugin before main container
- ReOrder Post Within Categories plugin with featured image
- Get all categories of custom post even not assigned
- Function to prevent users from trashing comments
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- How to add class in plugin only for network site?
- How does WordPress process plugin installations?
- Conditionally add apt. Open Graph meta data to different pages on WordPress site
- PHP Fatal error: Call to undefined function plugin_basename
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Executing my function once on a specific time
- Missing Argument
- load_plugin_textdomain error
- Adding Shortcode to Text Widget
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Using a function to change favorites listing
- WP Query. Is there a maximum size?
- How to remove custom post type and add category and post name
- How to export all content with feature images?
- bbPress plugin: forum lists not showing in correct order? [closed]
- Difference and examples of esc_attr__() and esc_attr_e()
- the_tags : can we insert a class
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- WordPress checkbox and Illegal string offset
- Undefined index: action plugin problem
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Adding class to last list item? Not WP generated
- Replacing global wp_query
- I changed .live() to .on() but change is not reflected on the server
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- How can I fetch data from another website to my wordpress website with mysql database
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- how to change wp-admin url using function file
- same user role or copy the user role to be same as the other role
- Expected ‘add_filter’ (T_STRING)
- Could not add ‘LoginLogout’ link using BAW login logout plugin
- My widget won’t update its values when save is clicked
- Execute a function when the entire page is displayed
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- How would I get the new plugin version on this function?
- Sharing varible between two add_actions
- Search in WordPress
- Modify function output in a plugin
- Override filter variable not working
- Is admin section completely customizable in terms of styling?
- How to make the first letter of a post title uppercase, in a plugin?
- Automatic set a featured image from the first image’s url (or tag) in the article
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Adding featured image to post display widget
- How to replace native comment_count with Comments Evolved aggregate count
- Code fails in plugin file but works in functions.php
- Conditional required fields for WordPress Contact Form 7
- Hook into install email
- wordpress Shortocode running twice?
- Cannot access variables within a widget
- Calling an custom field from theme option at the frontend
- WordPress plugin options need to delete after deactivate & uninstall
- WordPress function to add text
- Saving an array to get_options
- Doing action based on input from options menu
- add query string to all pages after user logged in
- Looking for a related post plugin which slides-in like the one at inc.com does [closed]
- Sync roles across several plugins
- Multiple Post Thumbnails Not Returning URL for Background Image
- Make plugin admin page visible to other roles
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- wp_enqueue_script doesn’t load JS in plugin