In the members-only forum a user asked:
Can you make a tutorial for setting a default featured image on a CPT in Genesis? For example, on a staff page when a staff member doesn’t have a profile picture available? To work in archives and single post.
By adding the following code in child theme's functions.php, we shall
- register custom image sizes for images on a Staff Custom Post Type archive and single pages.
- remove the featured image coming from Genesis settings (if set) and display left floating images (linking to their permalinks) on the Staff CPT archive. For entries with no featured image, a default image from the child theme's images directory will be set to appear.
- display image on Staff CPT single pages above the content. If a featured image is not present, a default image will appear.
CPT archive page:
CPT single entry page when featured image is present:
CPT single entry page when featured image is not present:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.