-
germansf
I’m looking for advice on how to easily customize my author page with GeneratePress by adding a lot of content there. My own author page needs to be highly customizable, while future author pages can remain simple, dynamic author archives.
Current Situation:
– I’m the only author on my WordPress site.
– I want to create a custom author page at /author/name-surname/ that I can easily edit like a regular post or page, including headings, images, etc.
– In the future, I may add more authors, so scalability is a consideration, but regular author archives with a simple bio would work fine for future authors.Solutions I’ve Considered:
– Using GeneratePress Elements: Creating a Block Element to insert custom content into the author archive page. But targeting options are limited – I can only target all archives (but for now it might be okay solution).
– Custom Rewrite Rules: Mapping an editable page to the author URL using custom rewrite rules. Seems complex and might have SEO implications – duplicate content, etc… unless I add noindex to one page.What I’m Seeking:
– Recommendations on the best technique to achieve an easily editable author page at /author/name-surname/.
– Advice on how to set this up in a way that is scalable for additional authors in the future with simple author pages.Thank you!
-
Alvind
Hi there,
You can’t directly edit author pages since they are dynamically generated, but using GP Elements is a great solution. To set this up, create two archive Elements — one for your profile and another for other authors. Then, you can use the
generate_element_display
filter to conditionally display each Element based on the author.https://docs.generatepress.com/article/generate_element_display/
-
germansf
Thank you for the answer! 🙂
Could you please provide further guidance on this?
I have a page hero element set up for all author archive pages. Now, I’d like to add a specific content element for one particular author. My goal is for this author’s archive to display only the page hero element and this custom content element—no other elements should be included.
-
1. Get the element ID from the URL when editing the element, replace
100
with it.2. Replace
Tom
with the author name or author ID.3. Do not set any location for the element and add below PHP snippet:
add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 100 === $element_id && is_author( 'Tom' ) ) { $display = true; } return $display; }, 10, 2 );
Adding PHP: https://docs.generatepress.com/article/adding-php/
-
germansf
Awesome! All works! Is there a way to also disable generatepress element on certain author archives?
-
Yes, you can change the code
$display = true
to$display = false
.add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 100 === $element_id && is_author( 'Tom' ) ) { $display = false; } return $display; }, 10, 2 );
- You must be logged in to reply to this topic.