Archived topic
Link to author bio URL
7 replies · Started by Adam on February 12, 2023
I've set up an author bio area, but I want to link the three dots to the URL that is linked to the author in their bio - not to their other posts.
I've looked at various code snippets etc but can't seem to fathom it out myself.
It would also be good if there is any way to implement something like 'Visit them at XXXX' too if doable?
Hi Adam,
How do you store the URL? Is it a custom field attached to the user or the WP default website field in the user profile?
Let me know!
Hiya,
The link is in the private info box for the original post, can you see it?
This is the code I'm using for the author box:
.author-box {
padding: 3%;
padding-bottom: 10px;
margin-top: 30px;
font-size: 0.9em;
background-color: #fff;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
box-shadow: 0 9px 28px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
}
.author-box .avatar {
width: 200px;
height: auto;
border-radius: 100%;
margin-right: 30px;
}
h5.author-title {
margin-bottom: 0.1em;
font-weight: 600;
}
.author-description {
line-height: 1.6em
}
.author-links a {
margin-top: -1.5em;
font-size: 2em;
line-height: 2em;
float: left;
}
@media (max-width: 768px) {
.author-box {
padding: 20px;
padding-bottom: 25px;
margin-top: 60px;
flex-direction: column;
text-align: center;
}
.author-box .avatar {
margin-right: 0;
width: 100%;
margin-top: -25px;
}
.author-box .avatar img {
max-width: 100px;
}
.author-links a {
float: none;
align-self: center;
}
.author-description {
margin-bottom: -0.1em;
}
}
Hi there,
how was the author box added to your site ?
Is it using PHP/HTML in a hook element for example
Ah sorry!
I followed this guide here adding a new hook in elements.
https://www.wplogout.com/add-author-box-in-generatepress-theme/
Problem with using that code is the blogger didn't write the code, so he can't support it.
This line is what outputs the link:
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more">...</a>
try changing it to:
<a href="<?php echo get_the_author_meta( 'url', get_the_author_meta( 'ID' ) ); ?>" title="Read more">...</a>
Or instead you can build your own author box using a Block Element
Thanks that works great!
Glad to hear that