- This topic has 15 replies, 2 voices, and was last updated 3 years, 3 months ago by David.
-
AuthorPosts
-
January 4, 2021 at 10:40 pm #1605924Anders
Hi!
I submitted a topic about this yesterday, but it seems to have disappeared. Her it comes again:
I want some extra text on my Portfolio category archive page (category description).
https://simpliweb.se/category/portfolio/and I want my user “biography” be displayed on my author archive page.
https://simpliweb.se/author/anders/How to do? Or should I use the Elements? I tried to add a text in the Page Hero field but it did not show up.
See screenshots below
January 5, 2021 at 4:13 am #1606246DavidStaffCustomer SupportHi there,
the Category description you can use this template tag:
{{custom_field.description}}
For the author Bio you will need to create a shortcode and add that to the header element, this article explains:
https://generatepress.com/forums/topic/adding-bio-to-author-page-and-adjustments/#post-1429130
January 7, 2021 at 6:20 am #1609392AndersThanks it worked for category description but for the author bio I can not solve it. Where to put the shortcode? I tried different ways in the Element. Will the shortcode get the text from the wp admin user description field?
see screenshot
January 7, 2021 at 6:45 am #1609420DavidStaffCustomer SupportDid you add this code to your Site?
add_shortcode( 'author_bio', function() { ob_start(); echo wp_kses( get_the_author_meta( 'description' ), null ); return ob_get_clean(); } );
This article explains how to add it:
https://docs.generatepress.com/article/adding-php/The code will get that description from the User who is the author of that post, if thats the Admin then yes that will display their description.
January 7, 2021 at 7:24 am #1609656AndersYes I added the code with the Code snippet plugin. But I am not talking aboud adding the bio to posts, I want it to be added to the author archive page
https://simpliweb.se/author/anders/Right now I only get the avatar there
January 7, 2021 at 8:21 am #1609753DavidStaffCustomer SupportAah – in the Display Rules tab of the Header Element you should see the
Author Archives
locationJanuary 7, 2021 at 8:37 am #1609779Andersyes, I have chosen that. I still don’t understand where to put the shortcode. I mean in your first reply you gave me this code {{custom_field.description}} and that doesn’t work for Author archive page. So you mean I need to use a shortcode? Where to put the short code? See screenshots of my settings.
January 7, 2021 at 8:47 am #1609805DavidStaffCustomer SupportYou would need to create a separate header element just for your Author Archives and then add the shortcode to the header elements content instead of:
{{custom_field.description}}
January 7, 2021 at 10:48 am #1609939Anderssorry I still can’t make it work
neither of these lines work
<h1>
{{post_title}}
</h1>
<p>
{{author_bio}}
</p>
<p>
[author_bio]
</p>January 7, 2021 at 3:19 pm #1610166DavidStaffCustomer SupportCan you provide temporary admin access to the site so i can take a look at what the issue is?
January 8, 2021 at 1:11 am #1610519Andersok, thanks, see below
January 8, 2021 at 4:46 am #1610720DavidStaffCustomer SupportYou have two separate header elements:
Arkivsidor search-author-date
Arkivsida AuthorBoth of these have the: Författararkiv display rule.
Header Elements – there can only be one ever displayed, if you have two with the same display rule, the header element that was published first will be displayed. Which is what is happening here.
In the Arkivsidor search-author-date remove the Författararkiv display rule. Then you should see the Arkivsida Author
January 8, 2021 at 5:07 am #1610740AndersThanks, I thought I did that earlier but maybe it wasn’t saved. Anyway, now, how to enter the shortode? I tried all possible combinations of brackets.
1.
<h1>
{{post_title}}
</h1>
<p>
[author_bio]
</p>2.
<h1>
{{post_title}}
</h1>
<p>
{{author_bio}}
</p>3.
<h1>
{{post_title}}
</h1>
<p>
{{[author_bio]}}
</p>4.
<h1>
{{post_title}}
</h1>
<p>
[[author_bio]]
</p>5.
<h1>
{{post_title}}
</h1>
<p>
{author_bio}
</p>What appears on the author archive pages is:
Gravatar
Anders
[author_bio] (or whatever code I tried)January 8, 2021 at 7:20 am #1611061DavidStaffCustomer SupportOption 1 ie.
<h1> {{post_title}} </h1> <p> [author_bio] </p>
The issue: Go to Code Snippets and Active the
Redigera kodsnutt
snippet as its currently disabled.January 8, 2021 at 7:38 am #1611095AndersOK, thanks it works!
-
AuthorPosts
- You must be logged in to reply to this topic.