Featured image field for questions

9.00K viewsUpdates
0

Hey, is there a way to put a featured image on a question please, just like with a regular WordPress post ? (so that it shows rather than the picture of the person who posted the question for instance).

Also I am trying to use anspress on a template that uses a masonry design and that would be awesome to show every question with its featured image.

Thanks for your answer  🙂

Answered question
0

What I did so far : Ok so I found a way to add featured images, also called ‘thumbnails”, in Anspress questions, by doing the following :

Added this code to my theme’s functions.php :

add_action(‘init’, ‘my_custom_init’);
function my_custom_init() {
add_post_type_support( ‘question’, ‘thumbnail’ );

On the Anspress file question.php, added this to display the thumbnail :

<?php

if (has_post_thumbnail()) {
// display the featured image
?>                            <div id=”thumbnailquestion”><?php the_post_thumbnail(); ?>

It works but the admin has to upload images in the backend for them to show has featured images.

What I’d like to do now : I’d like users (and not only the admin) to be able to upload featured images too (the images uploaded through the attachment box would be automatically set as featured images).

 

How I think it could be done : I Imagine there’s something to be changed in the upload form https://github.com/anspress/anspress/blob/b2b86fc8f91b6c96a065ffbf14212e7967610fb9/includes/upload.php but I can’t exactly figure out what. I’ve been trying lots of things myself :/ And yet I’m sure it’s not that hard !

 

Thanks for your help !

You are viewing 1 out of 5 answers, click here to view all answers.