It looks like I will need to create custom PHP code for this and either add it to my includes directory within a custom PHP file, or to the functions.php file.

I need the ability to use a featured image in a post and be able to also dynamically display that same image in a gallery on the frontpage.

I am not a PHP master by any means, but I know a bit to get around.

My guess is I would need something comparable to this:

if ( has_post_thumbnail() ) {     
    echo '<div style='background-image: url(' . get_the_post_thumbnail_url() . ');></div>';

How would I get the featured image to display within in a certain section on the frontpage? Would I need to create a custom class to place this in a specific section on the frontpage?

There’s a “Projects” custom post type where the actual posts are created. There are fields within this post type created using ACF. There’s a “Project Featured” section in this custom post type that offers a toggle to turn off or on “Featured”. If the toggle is on, that is when the featured image should be used and displayed on the frontpage.


  • Create a loop using WP_Query class. You should make use of the meta_query parameter to display those featured projects.
    – Abhik
    Commented May 12, 2022 at 2:47
  • Care to give an example? Commented May 12, 2022 at 12:40
  • Check the link in my first comment.
    – Abhik
    Commented May 12, 2022 at 12:56
  • I am already using WP_Query and it's working kinda, but I need to have the featured images placed in a certain area on the front page. How do I go about that? Thanks Commented May 12, 2022 at 16:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.