Archived topic
Page Hero Design/Reuse Elements
3 replies · Started by S on January 8, 2019
Hi,
I am trying to do two things:
1) I want to design a page hero that is similar to the design used on the current GP website where there is some styled content on one side and a hero image on the other side.
Example: https://generatepress.com/premium/ - see the "Take GeneratePress to the next level with GP Premium." on the left and the hero image on the right
What is the best way to do this? Where should I store the image? I do not want to use a background image. Need to have it in a central place so that if it is updated in one place it will update on all pages it is used on.
It would be nice if there was a shortcode/tag that could be used in the Layout tool to show the featured image.
2) What is the best way to add testimonials so that they appear on every page - say above the footer? Want to store it in a central place so testimonials can be updated in one central place
Hi there,
1. the header element is the way to do that, and you can create your own shortcode to display the featured image:
add_shortcode('featured_img', 'fi_in_content');
function fi_in_content($atts) {
global $post;
return get_the_post_thumbnail($post->ID);
}
2. The Hook Element, just need to add your content to the before_footer hook and set the display rules:
https://docs.generatepress.com/article/hooks-element-overview/
Thank you for replying. I am fairly new to WP - do you have any instructions on where to include the function?
Which PHP file do you recommend?
So this article covers:
https://docs.generatepress.com/article/adding-php/
If you have a child theme then it goes in your functions.php file.
If you don't then use the Code Snippets plugin that is linked in the above article