- This topic has 14 replies, 2 voices, and was last updated 4 years, 5 months ago by
David.
-
AuthorPosts
-
November 30, 2018 at 8:45 am #744817
rockett
I want to have the page hero pull the featured image / pst title & Post excerpt.
I can’t seemed to find the tags for that?November 30, 2018 at 9:01 am #744830David
StaffCustomer SupportHi there,
do you want to display the auto excerpt generated by WP or the one you add to the Excerpt meta?
November 30, 2018 at 9:02 am #744831rockett
Hi David,
Either is fine but I guess Excerpt Meta would make more sense for controlNovember 30, 2018 at 9:30 am #744847David
StaffCustomer SupportSo probably best to just output if a Custom Excerpt exists. And we can create a short code for that like so:
function db_page_hero_excerpt() { ob_start(); global $post; if ( has_excerpt( $post->ID ) ) { ?> <div class="page-hero-excerpt"> <?php echo the_excerpt(); ?> </div> <?php } return ob_get_clean(); } add_shortcode( 'page_hero_excerpt','db_page_hero_excerpt' );
https://docs.generatepress.com/article/adding-php/
Once you have that added to theme, then use this shortcode in the hero:
[page_hero_excerpt]
December 3, 2018 at 7:57 am #746850rockett
Works a treat sir, thanking you kindly…
Now I just need to work out why the read more button disappears if I use custom excerpts.December 3, 2018 at 8:01 am #746853David
StaffCustomer SupportAwesome. Could try echoing the permalink as well π
echo '<a href="'.get_permalink().'">Read More</a>';
December 3, 2018 at 8:11 am #746865rockett
OK so I followed the instructions to re add the read more buttons when using manual excerpts.. But, it now adds them to the page hero.
I guess I need to comment them out or similar?December 3, 2018 at 8:13 am #746866December 3, 2018 at 8:15 am #746867David
StaffCustomer SupportAah sorry my bad, i did wonder why you would want the read more in the page hero π
This should still work:December 3, 2018 at 8:23 am #746874rockett
No the first route worked well for the front page posts just below the Lets Work section…. but it also adds it to the post Page Hero with the manual excerpt.
Is there some kind of filter I can add to the page hero to not show Read More there?December 3, 2018 at 8:30 am #746883David
StaffCustomer SupportRight if you’re using the filter that was provide here https://generatepress.com/forums/topic/how-to-display-read-more-when-using-the-excerpt-field/#post-297608 then you could omit it from being displayed on single pages by changing:
if ( has_excerpt() ) {
to this:
if ( has_excerpt() && !is_single() ) {
December 3, 2018 at 8:34 am #746888rockett
Bloody Marvellous.
You guys rule really.
I can’t wait to finish converting my site and then start making videos to sell GeneratePressDecember 3, 2018 at 10:05 am #746980David
StaffCustomer SupportAwesome – Love to see people really leveraging GP’s Elements. And please do share when you have started recodeding π
December 14, 2018 at 8:20 am #756731rockett
Guys I really have enjoyed creating my site in GeneratePress and after doing several edits and css add ons I am really happy with both the function and speed I am scoring on chrome’s lighthouse and pingdom.
I have also moved a couple of clients over to GeneratePress and will continue to fly the flag so to speak!
Well done.My site if you fancy a look: https://rockett.co
December 14, 2018 at 8:28 am #756738David
StaffCustomer SupportThanks for the great feedback. Site looks great – love what you done with the archive layout and post cards. Thanks for sharing.
-
AuthorPosts
- You must be logged in to reply to this topic.