Site logo

Archived topic

Posts Header Inside Content Area (Left of the Side Bar)

9 replies · Started by Eric on December 4, 2018

Viewing posts 1–10 of 10

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.

Hi 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';
} );

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.

That worked perfectly, thank you!

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,
Eric

Hi 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.

Alternatively, you can try this hook: generate_before_main_content

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?

Hi there,

looks like Tom included the filter within 1.8 so no need to edit the class-hero.php

This archived topic is closed to new replies.