I have a questions about importing posts in wordpress using csv import. I have mapped the csv like this “post_title” “post_content” “featured_image”etc. All the post were imported but the featured image is not showing.
The featured image url is showing in the custom field only.
My question is,How do I get the featured image to show? as I have hundreds of posts, I can not edit them manually.
I had the same problem â I had custom fields on several posts that contained URLs which I wanted to use for featured images. I knew some of the images were already in my media library, so I made the following functions to add an Bulk Edit-action to the editor window, which looped over the posts and uploaded images where the image wasn’t in the library already, or got the ID of the image already in the library, and then set that as the new featured image for the post.
It’s a rough code, but it works fine â please back up your site before doing this though.
You have to create a new single-post.php template and add the php for the custom field. You can add the new single-post.php template in a child theme so it is not overwritten by theme updates.
You can use this custom post generator to help you get started. Anything in a child theme is called first. So in your new custom single-Post.php (but call it custom-Post.php or something like that) add the logic (if…then) to render the themes single-post.php.
Then in your new custom-Post.php add this where you want the image to be displayed:
**<img src="<?php the_field('advanced_custom_field_name'); ?>" alt=""/>**
.The custom-Post.php will add the image tag for the html and Advanced Custom Fields will fill in the URL.
Alternatively, there might be a setting in your theme that allows you to render the Featured Image in the single post display.