- This topic has 9 replies, 3 voices, and was last updated 5 years, 8 months ago by
David.
-
AuthorPosts
-
December 4, 2018 at 7:26 pm #748299
Eric
I setup a header in Elements so that my post title overlays the featured image, but I want to keep that featured image contained in the content area, to the left of the side bar, not above it. Is it possible to change the location of the header? I’ve read a few older posts in the forums on this subject but I’m checking to see if there is an update.
December 5, 2018 at 9:57 am #748927Tom
Lead DeveloperLead DeveloperHi there,
Currently, this isn’t possible.
However, I’m considering adding a filter in GPP 1.8 that would allow for this.
If you’re interested in trying it out, you could do this:
1. Open
wp-content/plugins/gp-premium/elements/class-hero.php
and find this line:add_action( 'generate_after_header', array( $this, 'build_hero' ), 9 );
2. Replace it with this:
$location = apply_filters( 'generate_page_hero_location', 'generate_after_header', $post_id ); add_action( $location, array( $this, 'build_hero' ), 9 );
3. Then you could add a custom function like this:
add_filter( 'generate_page_hero_location', function() { return 'generate_before_content'; } );
December 5, 2018 at 2:26 pm #749136Eric
Ok thanks, I’ll try that. Where do I insert that custom function? In the class-hero.php file? I’m a novice with this stuff.
December 5, 2018 at 4:04 pm #749215Tom
Lead DeveloperLead DeveloperThe custom function can be added using one of these methods: https://docs.generatepress.com/article/adding-php/
December 9, 2018 at 4:33 pm #752362Eric
That worked perfectly, thank you!
December 10, 2018 at 9:11 am #753026Eric
I spoke too soon, I do have one more question, sorry!
I’ve replaced the code in class-hero and added the custom function to move my page hero from above the content to within the content …
Is it possible to make the page hero (featured image) span the entire width of the content area? … Meaning ignore the content padding? I’ve been playing around with Word Press 5.0 and I see that you can make images “wide”. I want to do that same thing with the page hero / featured image.
I posted an example of the wide image here:
http://www.ericsturgeon.com/2018/12/10/this-is-just-a-test/Thanks,
EricDecember 10, 2018 at 11:41 am #753153David
StaffCustomer SupportHi there,
you can try this CSS, which does what the Block editor does to make an image full width:
.page-hero { margin-left: -50px; margin-right: -50px; }
The 50px is the container padding that you have set.
December 10, 2018 at 4:38 pm #753323Tom
Lead DeveloperLead DeveloperAlternatively, you can try this hook:
generate_before_main_content
May 22, 2019 at 6:05 pm #908346Eric
Hi Tom,
I still have version 1.7.8 and haven’t yet upgraded to 1.8.2. After I upgrade, will I need to edit the class-hero.php file the same way that you advised in order to display my featured image w/ title overlay within the content area as opposed to above it?
May 23, 2019 at 6:10 am #908678David
StaffCustomer SupportHi there,
looks like Tom included the filter within 1.8 so no need to edit the class-hero.php
-
AuthorPosts
- You must be logged in to reply to this topic.