- This topic has 17 replies, 4 voices, and was last updated 4 years, 8 months ago by David.
-
AuthorPosts
-
August 2, 2019 at 3:45 am #973733Charalambos
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
August 2, 2019 at 6:15 am #973828DavidStaffCustomer SupportHi 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.
August 3, 2019 at 4:35 am #974630CharalambosHello,
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
August 3, 2019 at 8:36 am #974868TomLead DeveloperLead DeveloperHi there,
There shouldn’t be a default WordPress one. Can you link us to the page?
August 3, 2019 at 12:46 pm #974981CharalambosSure, here is a link to an author page below,
August 3, 2019 at 2:00 pm #975009LeoStaffCustomer SupportTry this CSS:
.author.archive .page-header { display: none; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know 🙂
August 3, 2019 at 2:35 pm #975027CharalambosThanks, 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?
August 3, 2019 at 3:00 pm #975033DavidStaffCustomer SupportTry adding this CSS:
.archive.author .molongui-author-box { padding-left: 30px; }
August 3, 2019 at 3:31 pm #975045CharalambosHello, 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?
August 3, 2019 at 3:37 pm #975052DavidStaffCustomer SupportI edited the CSS to target just the author archive.
August 3, 2019 at 4:05 pm #975057CharalambosIt 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.
August 3, 2019 at 6:48 pm #975109LeoStaffCustomer SupportThat’s all coming from the plugin itself:
https://www.screencast.com/t/g6wKD8RAQAugust 4, 2019 at 4:48 am #975273CharalambosHello,
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.
August 4, 2019 at 8:28 am #975503TomLead DeveloperLead DeveloperThat’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.
August 4, 2019 at 10:43 am #975588CharalambosOh 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?
-
AuthorPosts
- You must be logged in to reply to this topic.