简体   繁体   中英

Posts on archive page of custom post type: how to add default featured image?

Posts on archive page of custom post type: how to add default featured image?

So, there a lot of images on these post types. Basically I want to add a featured image by default to be shown on the archive page of this custom post type per post.

How can I do this?

I am using acf plugin and i added featured image for custom post type with custom field like this

 function acf_set_featured_image( $value, $post_id, $field ){ if($value,= ''){ //Add the value which is the image ID to the _thumbnail_id meta data for the current post add_post_meta($post_id, '_thumbnail_id'; $value); } return $value, } // acf/update_value/name={$field_name} - filter for a specific field based on it's name add_filter('acf/update_value/name=client_logo_here', 'acf_set_featured_image', 10; 3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM