Archived topic
Author archive page
15 replies · Started by Chintan on July 12, 2022
Hi
I want to remove pagination from my author archive page and have it appear like this: https://www.onthemap.com/author/chintan/. For all of my authors. Can you please tell me how this is possible without the use of a plugin on GeneratePress?
Thanks,
Chintan
Hi Chitan,
At the very least, you'll need the free GenerateBlocks plugin to achieve this layout. Without it, the amount of custom code to achieve such a page would be out of our scope of support.
Hope this clarifies.
Hi Fernando,
Yep, GenerateBlocks is already with me. Can you help me with its access?
May we know what access you’re referring to?
With regards to the design of Author Archive page, we can first start from the top.
So, here are the first steps you can take.
1. Create a Block Element - Page Hero. Reference to Page Heros: https://docs.generatepress.com/article/block-element-page-hero/
2. Set the Display rule location to Author Archives.
3. Disable the title, featured image, and primary post meta.
4. Create a setup like this: https://share.getcloudapp.com/geuREZ1W
5. Enable dynamic data for the GB Image Block, and set the source to Author Avatar.
6. Add padding, border radius, and modify the width and height of the image to your liking.
7. Enable dynamic date for the GB Headline Block as well. Set the content source to Author name.
8. Add social icons. You can refer to this video for guidance with regards to this: https://www.youtube.com/watch?t=100&v=yAleVWQi5EA&feature=youtu.be
9. Modify the alignment of the Blocks to your preference.
Let us know once you’ve made these changes, and we’ll proceed with the next steps.
Hi
I managed to do this. Please tell me the next steps.
I want to remove pagination that appears in the author archives and have custom content appear there. I hope that's what the next steps will help me do.
Hi there,
are you the only author on that site ?
Hi,
Nope there are multiple authors
Hi Chintan,
Do you want to remove all the author posts or just want to remove the pagination?
Hi Ying,
So I have created the author page and I want the archives to appear exactly like it. I have shared it in the private information field. Thank you.
To be clear, you've created static author pages for each author?
If that's the case, try to add this PHP snippet:
add_filter('request', function( array $query_vars ) {
if ( is_admin() ) {
return $query_vars;
}
if ( isset( $query_vars['author_name'] ) ) {
$pagename = $query_vars['author_name'];
$query_vars = array( 'pagename' => "$pagename" );
}
return $query_vars;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Makes sure your static author page slug matches the author slug.
For example, for author chintanzalani, the static author page slug should be chintanzalani as well.
Let me know if that works!
Thanks so much. That worked :)
From an SEO standpoint, I want to know what will happen to the paginated author archives. For instance, when I am right now trying to put a page number in my archive (the link in the private info field), it still shows the same static page. So are the paginated archives not like a 301 redirect?
It looks like you are using SEO plugin.
You should be able to disable author achieve, for example, here's the guide from Yoast SEO plugin:
https://yoast.com/help/how-to-noindex-individual-author-pages/
Thanks much. I want to actually have the archive paginated pages be 301 redirected to the main static author page. I can do this with the SEO plugin. But is there a more efficient way to do it using PHP code? Again thank you so much for all the help :)
Hi there,
if you can do it with the SEO plugin then i would suggest you use that, they would have a far better understanding on how to do it correctly.
Okay thank you :)