the_post_thumbnail()
prints the HTML immediately. Use get_the_post_thumbnail()
instead to get the HTML into your string.
$content .= '<div class="thumbnail">'
. get_the_post_thumbnail( null, "home-post-thumbnail")
. '</div>';
Related Posts:
- Proper use of Output Buffer
- Does My Child-Theme Functions.php Need if{die} Security In It? [duplicate]
- Debugging an error: wp_enqueue_style was called incorrectly
- class=”parent” for wp_list_pages?
- Changing the HTML Of the content
- if has theme mod
- How to override a non pluggable and non hookable function in a WordPress parent theme?
- Count Title and Post Characters
- Remove css styles from specific page
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- HTML table from shortcode with multiple parameters
- Using PHP to toggle stylesheet and header image, set in cookie
- Differences when using the the_time and the_date functions
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Using Multiple Submit buttons to trigger customised php functions
- How to get specific image in media library with php
- Displaying the Month and Year that a page was Created?
- Only Show Link If div Exists
- How to access global variable $menu inside a class function
- Change the WP Video Shortcode Output
- How to pick the default selected value in wordpress dropdown?
- Using WP-API and SSE not authenticating user ID
- Validate functions before inserting then into functions.php
- How to retrieve current wordpress profile page URL?
- Search not showing all results
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- How to Reference/Echo Variable from Another PHP Function
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Exclude category
- How can I make an object available through the entire site?
- WordPress admin-ajax.php
- What exactly do this function declared into functions.php file of a WP theme?
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- How to use html inside a functions.php code?
- Nested “do” and “add” Actions is possible?
- Display Data in Table from External Database in WP using Shortcodes
- How to check if a Customizer setting is set?
- linking stylesheets and scripts with functions.php
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Remove item in Checkout
- How to get current post category details inside “loop”?
- Co-Authors Plus: How do I get all authors with a query?
- How to reference PHP in Javascript
- Only load certain artists on this page
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Get the alt text of the image in a array
- making php value numeric
- Migrating site, only header shows
- Custom functions for string data calculations
- How are these PHP functions applied to a specific page in WordPress?
- remove specificly the last tag in all posts
- Let current user know pending posts counts using wp_query
- How to check post meta isset or not empty during publish/save post?
- how to changes mobile menu toggle breakpoint in WordPress
- Get page permalink in contact form
- How to display already created menus via php?
- Grabbing Image name From Product Image Gallery
- “pre_get_posts” orderby custom date field in different format?
- How to hide a child category and show his parent category
- Gutenberg block don’t save rich text content
- remove_action from parent theme using child theme functions.php
- Cant get blog name with get_option
- php code for outputting a custom page in my account
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- Remove span tags from WooCommerce Downloads page
- Extra editor on top of default in Custom Post Type
- How do I fix Undefined variable using $_POST in function?
- How to add typehints to function in functions.php when argument is an object?
- Pagination 404 error(I have refreshed the permalinks and tried several previous options)
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Add element after navigation element title don’t works like I expect
- Get Billing Email from WooCommece Checkout and Pass to Fullstory JS
- How to delete specific element when it is not homepage?
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- How can I include tags in wordpress search without a plugin
- Using catch_that_image() for galleries?
- How to set up an auto delete post?
- apply_filters() function
- Get category id for a custom category and display it in a class
- Calling the Next category link on an archive page – WordPress
- Using tag to output text in Genesis?
- Conditional Content Display
- Merging two excerpt functions to work with conditions
- wp wp_register_script function results type parameter missing
- php “use” not working in template [closed]
- How to add margin underneath woocommerce total price amount -> productpages
- display php code in header using wp_head()
- Load slideshow.css file only if Slideshow is checked / on
- add if statement to the featured image
- Sorting Problem
- Dynamic Email Handler with ‘header (“Location: …’
- WooCommerce: write featured image dimensions to custom fields in product’
- Generate and upload screenshot as featured image for user-submitted post
- a problem in class in class-wp-hook.php
- transition_post_status hook, works – but not if the post is new
- change title of page dynamically
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page