Archived topic
Blog archive page header element
9 replies · Started by Dan on February 28, 2022
Hello
I'm using a block element for the blog's archive page.
Instead of showing the feature image of the blog page, it pulls in the featured image of the last blog created in the post. Also, it does not pull in the custom fields into the block element.
A similar issue is posted here:https://generatepress.com/forums/topic/featured-image-in-a-block-element-on-the-blog-page/
I would like to use the featured image option rather than set a static image.
Is there a workaround?
Thanks!
Dan
Hi Dan,
Instead of showing the feature image of the blog page, it pulls in the featured image of the last blog created in the post
That's normal behavior as blog page is an archive page, even you've created a static page for it and assigned a featured image there.
I would also recommend using a static page.
Thanks Ying.
The page is the blog archive.
It displays a list of posts with the featured image of each post next to them. That is ok.
What I am referring to is adding an image at the top of the archive page. This would be the page's featured image, not the post's featured image.
So I created a page hero element, and added the dynamic featured image block.
But, it doesn't use that image, but rather the featured image of the last post that was published,
If this is a WP thing, pulling in a post's featured image into an element, what would be a way around this using GB element with a featured image and some custom fields?
Would setting the display rules to archive or category rather than 'blog' help?
Thanks
Dan
Hi Dan,
Yes, setting the Display rules specific to an archive page with your preferred static image would be one way to do what you’re going for. As said, you would need to create multiple blocks with static images to do this.
See: https://share.getcloudapp.com/yAukprgW
Also: https://share.getcloudapp.com/p9uXvA4Z
To achieve this dynamically, your idea of using a custom field is a good approach to this.
See: https://share.getcloudapp.com/jkumzP60
Also see: https://share.getcloudapp.com/Apux7zlG
Also see: https://share.getcloudapp.com/Apux7z2r
As shown, after adding a custom image field to the terms, I retrieved this dynamically through a Container Block. I simply set it to Term meta with a meta field name of the name I specified for my custom field(imagetest).
Alternatively, you may also use a Hook Element to hook the custom field: https://docs.generatepress.com/article/hooks-element-overview/
Hope this clarifies! :)
Thanks For the explanation Fernando.
But the problem is, once I set a page to be as the "Blog" in WP settings "Posts page"
it disregards any dynamic setting with GP elements.
That is the issue I am facing.
Dan
Hi there,
Its not something GP can get around as WordPress ignores any metabox content for the Home Page when its set to Display Latest posts, including the Featured Image.
Thanks David.
It's not the homepage but the 'posts' page. But I guess that is the same for this matter.
Yep - same whether it be the Front Page or a Static page. In WP's weird world Homepage is where the latest posts are listed ( is_home() ) .
You may find a way with ACF options but i don't think GP will be able to get there as its dynamic data relies on current ID.
yes, I've thought of ACF options, no way GP Elements can connect to that?
Not without custom development as GP relies on the data being stored against the current object.