I have created a custom theme, and have post excerpt on the front page from two categories.
I would like to have featured images for each excerpt, but it is not working with the solutions I have found here. It says either internal 500 error, or the featured_media is undefined.
The featured image turns up inside the post, but not on the front page. I am importing from
// import FeaturedMedia from āā¦/featured-mediaā;
return (
<>
<PortfolioContainer>
<StyledTitle>{category.name}</StyledTitle>
<FlexPortfolioContainer>
{posts.slice(0, 3).map((p) => (
<FlexPortfolioItem key={p.id}>
<img src={ImagePlaceholder} />
<Link link={p.link} key={p.id}>
<h2>{p.title.rendered}</h2>
<FeaturedMedia src={fmedia.source_url} />
<Html2React html={p.excerpt.rendered} />
</Link>
</FlexPortfolioItem>
))}
</FlexPortfolioContainer>
</PortfolioContainer>
</>
);
}