Want to add user-bio formatting to child theme
What I want to do (I think):
To display the bio with format you have to process the contents of it first.
Assuming you got the user data by using:
$userdata = get_userdata(intval($author));
The biographical info is in: $userdata->user_description, and to display it the way you want, apply the filter ‘the_content’ to it
$user_description = apply_filters(“the_content”,$userdata->user_description);
This should display the bio with line breaks or the format you entered.
But where? How?Mod
The dollar signs mean that this is PHP programming language, which means that you would need to create a child theme.
Where to put it? Somewhere in loop.php, I think, but I am not a PHP expert. There is a lot of discussion about child themes on this forum, so what you are looking for might be there.
Thanks, Ken. That helped a bit. The code in question is in loop-author.php in the graphene theme:
<?php do_action(‘graphene_author_details’); ?>
<?php if (get_the_author_meta(‘description’) != ”) : ?>
<h4><?php _e(‘Biography’, ‘graphene’); ?></h4>
<p><?php the_author_meta(‘description’); ?></p>
<?php do_action(‘graphene_author_desc’); ?>
<?php endif; ?>
…but I still cannot figure out how to keep it from stripping out line breaks. Lots of discussion online about this, but nothing that’s working with Graphene.
I’m already using a child theme, but it’s just CSS overrides. Here’s an example of the page where I’d like to see the bio broken up into smaller paragraphs:
Not looking to include a lot of fancy HTML, just want to preserve the white space that breaks the bio up into paragraphs.Mod
Okay, first things first.
The “About the Author” is supposed to be very short, like this:
Kenneth John Odle is the well-known Canadian author of the best-selling book Monetize Your Pets. He invented wine, the question mark, and that little plastic thing on the end of your shoelace. His blog is “…in some weird postmodern way…” which can be read at blog.kjodle.net.
It is not meant to detract from the post content.
Second, the page you link to above is, well, a page, isn’t it? How did you create it? (I admit, there are some very basic things about WordPress that I am completely ignorant about simply because I don’t use them. Please teach us, or at least point us in the right direction.)
Third, you have a few alternatives here:
1) Just use short author bios like I mentioned above.
2) Use the plugin mentioned in the WordPress support forum post you linked to.
3) Create a series of pages, one for each of your authors. (You can include links and photos, as well.)
4) Add a request to the Feature Requests portion of this forum to include an option that will allow certain tags not to be stripped out of the author info, in much the same way that we can choose which tags are not stripped out of excerpts. (This may be incredibly difficult or it may be incredibly easy. I just don’t know.)
If you choose #4, I will add my voice to that request, because if you look at the entirely facetious example I gave above, the title of the book I mentioned really should be in italics, and it would be nice to actually link to a real page, like this:
Kenneth John Odle is the well-known Canadian author of the best-selling book Monetize Your Pets. He invented wine, the question mark, and that little plastic thing on the end of your shoelace. He blogs at …in some weird postmodern way…
I’m not going to make this feature request myself because this is not on my list of priorities, but if you request it, I will support it.
Now that is pretty funny! I think I’ll explore the plugin angle first to see if something is available. Yes, I could create a bio page for each contributor, and then link to the standard author’s page (sans bio). This is not a BIG deal, just an intellectual challenge.
I opted for this plugin: HTML in Author Bio
Nothing fancy — you have to embed your own HTML tags for paragraphs (it won’t convert line breaks for you), but it seems to work as advertised. For example, this author page — http://levantium.com/author/rayclose/ — has both paragraph tags and a link tag to the source of the bio used.
Viewing 7 posts - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.