- This topic has 9 replies, 3 voices, and was last updated 1 year, 5 months ago by
David.
-
AuthorPosts
-
November 7, 2020 at 2:40 am #1521433
Joost
Hi, i’d like to create a header for a custom post type with a featured image as a background image with a post tile, category text over it. How do I pull this dynamic data into the generatepress block?
November 7, 2020 at 6:00 am #1521568David
StaffCustomer SupportHi there,
you can add featured image backgrounds in GenerateBlocks 1.2 – its currently available for Alpha testing:
https://generateblocks.com/generateblocks-1-2-0/
Post title and Meta is something to come later within GeneratePress Premium
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 7, 2020 at 6:26 am #1521584Joost
Hi David,
That is awesome..it’s working like a charm!
thank you
November 7, 2020 at 7:22 am #1521773David
StaffCustomer SupportGlad to hear that!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 23, 2021 at 7:39 am #1630506Joel
Hello, I’m struggling to find this feature…apologies if I’m missing the obvious!
Thanks
January 23, 2021 at 8:57 am #1630578David
StaffCustomer SupportHi there,
the feature was removed from the final release, as we realised it was not the best most future compatible method for doing this… we’re working on dynamic content for GP Premiums Element Block which will support this first, after that we will look at integrating that tech into GB.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 23, 2021 at 11:17 am #1630704Joel
Thanks for getting back to me. A bit of a long shot but is it possible to enable Featured Images on Elements? If so I may be able to use Toolset to pull through the Featured Image dynamically but Featured Image doesn’t show as an option when using a Toolset container in Elements presumably because Elements don’t have a Featured Image?
Many thanks.
January 23, 2021 at 4:39 pm #1630882David
StaffCustomer SupportCurrently the Featured image is only available within the Header Element.
It will be added to the Block Element in the next update however.You can of course get the Featured Image URL using the
get_the_post_thumbnail_url
function:https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/
Then simply hook into the WP Head to output the styles for a
custom-class
eg.<?php $featured_img_url = get_the_post_thumbnail_url($post->ID, 'full'); if ($featured_img_url) { $style = printf( '<style>.custom-class {background: url(%1$s);}</style>', $featured_img_url ); return $style; } ?>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 24, 2021 at 11:17 pm #1632235Joel
Thanks David. I’ll take a look at this option until the next update.
January 25, 2021 at 2:11 am #1632389David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.