Site logo

Archived topic

Author Box on Posts Using Sections

7 replies · Started by Ryan Coisson on October 13, 2020

Viewing posts 1–8 of 8

For some reason I notice that when I use Sections to create a post or a page that the Author Box doesn't show at the bottom, however, if I just publish a piece of content with the native editor (not using Sections) it does show up.

Is there a way for it to show when using sections as well?

-R

Hi there,

Are you using a plugin for the author box?

Hey Leo,

No, I have it coded into the site.

- R

What is the code you are using? Are you adding it using a hook?

Hey Leo,

Yes, I'm using a hook here's the code:

<?php echo get_avatar( get_the_author_meta( 'ID' )); ?>

<h5 class="author-title"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></h5>

<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>

------
And I have this code in the custom CSS:

.author-box {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding: 4%;
margin-top: 30px;
font-size: 1em;
box-shadow: 0 9px 28px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
}

.author-links a {
font-size: 3em;
line-height: 0.5em;
float: right;
}

.author-box .avatar {
width: 30px;
border-radius: 100%;
margin-right: 20px;
}

.author-title {
font-weight: 700;
}

h4.author-title {
margin-bottom: 0.5em;
}

.author-description {
margin-bottom: 10px;
}

/* For Mobile Devices */
@media (max-width: 768px) {
.author-box {
flex-direction: column;
text-align: center;
padding: 50px 10px;
}

.author-box .avatar {
margin-right: 0;
margin-bottom: 10px;
width: 100%;
margin-top: -35px;
}

.author-box .avatar img {
max-width: 70px;
}
}

- R

Unfortunately Sections turn the default content container into a blank canvas (kind of like a page builder) so all the hooks within the content area are removed consequently.

I think the only solution is to turn that code into a shortcode and insert it manually.

Ok, how do I go about doing that?

Is there some documentation you can link me to?

This archived topic is closed to new replies.