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.
Thanks
WP_Query
class. You should make use of themeta_query
parameter to display those featured projects.