Site logo

Archived topic

Page Headers on User Profile/Author Pages

19 replies · Started by Xavier Verhoeven on September 7, 2017

Viewing posts 1–15 of 20

I love the way Page Headers can be applied to global locations, but I can't figure out how I can add them to author pages (eg http://khq.dietdigital.com.au/our-people/amy-buckley/). This is set up using an author.php template – is there a way I can call the page header from the template?

I want a Page Header that sits behind the nav area, so it's not something I can easily hardcode the HTML for.

Any pointers would be much appreciated, or if it's something that can be added to the plugin, that would be even better!

Hi there,

Currently you would have to do something custom for this, but I love the idea. I've made note of it to add to the Page Headers add-on.

Let me know if you need more info on the custom solution :)

Thanks Tom. A tip on the best way to implement this would be great. Seems like I'd need to hack at a couple of files in the plugin to get it working, which wouldn't be ideal.

Currently you would have to build your own page header without the plugin, then hook it into the author page.

Less than ideal - I'll see if I can bake this into the next version (no promises) :)

That would be awesome! I know it's a bit of an edge case, but I feel like it makes as much sense as having global locations for post types - just that authors isn't quite a post type.

I'll wait and see. If I need to implement before it's there, I'll just have to do it manually.

Thanks again. I'm a big GP fan.

Hi all - +1 on this (and as always, +1 on how much I love this theme!). Has this been done yet, or any pointers to someone who did it?

Thanks!

This hasn't been done yet, but will be soon.

GPP 1.6 is close, and this might not make it in. However, there is a new filter meaning we can easily create a Page Header and place it anywhere with a simple conditional :)

Sweet, good to know! Thanks, Tom!

No problem! Ping me back in here once 1.6 is released and I'll share the code :)

Sweet, thanks! :)

Hello,
Just used GP premium for the first time, on a new build. It's really great, nice work.

Is there a filter snippet anyone can share to place the page header in the aforementioned pages?

thanks!

Hi there,

This should work with GPP1.6

add_filter( 'generate_page_header_id', function( $id ) {
	if ( is_author() ) {
	 	return 17686; // ID of the Page Header to use.
	}
  
  	return $id;
} );

Thanks Leo, i'll give that a try!

No problem!

The snippet worked great, thanks!

I ended up using it for bbpress also, i was able to assign the page header to the main pages for bbpress through the global locations in the admin, with the exception of the profile page of the BB user. So i adapted the snippet above as follows and it works (just posting here in case anyone else runs into the same scenario).

Swapped "is_author()" with "is_bbpress()"

add_filter( 'generate_page_header_id', function( $id ) {
if ( is_bbpress() ) {
return 17686; // ID of the Page Header to use.
}

return $id;
} );

This archived topic is closed to new replies.