Archived topic
Author archives page
17 replies · Started by Charalambos on August 2, 2019
Hello,
I am using a plugin that lets you create custom guest author boxes, however when it comes to the author archives page, the theme shows its own author archives page. I have been advised by the plugin support that in order to make their plugin author box design to be displayed in those kind of pages I need to edit the author.php template of my theme by adding this code: <?php echo do_shortcode('[[molongui_author_box]]'); ?>
I am not using a child theme, as the gp hooks element and the code snippets plugin do the job so far. I guess you cannot do it through the hooks element, as this lets you add code in certain positions of the theme, like before head, after head etc. Can I use the code snippets plugin to insert that code into my author.php file and if yes how?
regards
Charalambos
Hi there,
try creating a new Hook Element and hook it into the position you want it to be displayed - visual guide here:
https://docs.generatepress.com/article/hooks-visual-guide/#archives
Then select the Author Archives in the Display Rules.
Hello,
Thanks, I have added their author box shortcode through the hooks element to display only in author archives page. However, now i get 2 author boxes, the plugin's and the wordpress default. Could you please advise how to hide the wordpress default author box (title and bio)?
regards
Charalambos
Hi there,
There shouldn't be a default WordPress one. Can you link us to the page?
Sure, here is a link to an author page below,
Try this CSS:
.author.archive .page-header {
display: none;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know :)
Thanks, it works! The only issue now is that the plugin's author box slightly exceeds to the left beyond the theme's container width (Although, it was like that even before adding your css). Any idea how to fix that?
Try adding this CSS:
.archive.author .molongui-author-box {
padding-left: 30px;
}
Hello, it works, however it applies everywhere there is an author box. Can i just apply this css rule only for the author archive page through the hook element i already created?
I edited the CSS to target just the author archive.
It works fine on desktop, however on mobile it looks messy. The line below the title and the bio have moved to the right exceeding the mobile's container width.
That's all coming from the plugin itself:
https://www.screencast.com/t/g6wKD8RAQ
Hello,
Thanks for indicating the plugin's code. I also noted that this plugin is taking quite a lot of space when i view the page source code. It doesn't slow down the site, but is this a bad thing in general?
Regarding this code, from what i understand, there should be no padding on left, right, top and bottom. However it slightly exceeds to the left even beyond the theme’s container width. See how the logo, menu and posts, which all have zero padding as well, align align vertically to the left, while the author box not.
That's happening because of where the plugins HTML is located (inside the post columns container).
Do you have any control over where the box is added? If so, we can add it to a different hook to fix the spacing issues.
Oh i see. By the way thanks for answering even though its sunday. Your support is perfect.
The thing is I have tried to add it in several hooks and this one - before_main_content - is the most appropriate in terms of where I really want it to be positioned. For example if I try the hook above, which is the inside_container, the padding is ok but it displays in full width ignoring the sidebar. If I try the one below which is before_content, the padding is again ok, but it displays in half width, as i am using the 2 columns blog.
I noted that in generatepress there is an option to add a custom hook. Perhaps this can help?