Author's latest posts

Posted in: Newspaper
Post count: 7

Greetings. I would like to show the post of the latest author, on below author name in Author Box.

I want to show the box as this order:

Picture
Name
Post Name+URL

Could you give me the PHP code for it? Is it possible?

Thank you.

Post count: 7

Managed to do it with these codes in td_block_authors.php (includes/shortcodes/td_block_authors.php)

$buffy .= '<div class="td-authors-url">';
$last_article = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC LIMIT 1", $td_author->ID), ARRAY_A);
$buffy .= '' . $last_article['post_title'] . '';
$buffy .= '</div>';

Post count: 7

Problem

After doing this, i have this problem.

The gap between titles and picture is getting longer while i scroll down.

And there is also a big gap below footer.

Please help me 🙂

Page css is below:

.td_top_authors {
margin-bottom: 64px;
}
.td_top_authors img {
position: absolute;
max-width: 70px;
left: 0;
/* responsive portrait tablet */
}
@media (min-width: 768px) and (max-width: 1018px) {
.td_top_authors img {
max-width: 55px;
}
}
.td_top_authors .item-details {
margin-left: 85px;
position: relative;
height: 70px;
top: 1px;

/* responsive portrait tablet */
}
@media (min-width: 768px) and (max-width: 1018px) {
.td_top_authors .item-details {
height: 55px;
margin-left: 70px;
}
}
.td_top_authors .item-details span {
font-family: 'Open Sans', arial, sans-serif;
padding: 3px 7px;
color: #fff;
font-size: 9px;
font-style: normal;
font-weight: bold;
margin-right: 5px;
}
.td_top_authors .td-active .td-author-post-count {
background-color: #4db2ec;
}
.td_top_authors .td-active .td-author-comments-count {
background-color: #4db2ec;
opacity: 0.8;
}
.td_top_authors .td-active .td-authors-name a {
color: #4db2ec;
}
.td_top_authors .td_mod_wrap {
min-height: 70px;
padding-top: 9px;
padding-bottom: 9px;
border: 1px solid #fff;
}
.td_top_authors .td_mod_wrap:hover {
border: 1px solid #ededed;
}
.td_top_authors .td_mod_wrap:hover .td-author-post-count {
background-color: #4db2ec;
}
.td_top_authors .td_mod_wrap:hover .td-author-comments-count {
background-color: #4db2ec;
opacity: 0.8;
}
.td_top_authors .td_mod_wrap:hover .td-authors-name a {
color: #4db2ec;
}
.td_top_authors .td_mod_wrap:hover .td-authors-url a {
color: #4db2ec;
}
.td_top_authors .block-title {
margin-bottom: 16px;
}
.td_top_authors .td-authors-url {
display: table;
position: relative;
top: -2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #4db2ec;
/* responsive landscape tablet */
/* responsive portrait tablet */
/* responsive portrait phone */
}
.td_top_authors .td-authors-url a {
color: #000000;
font-family: 'Open Sans', arial, sans-serif;
font-size: 16px;
font-style: normal;
line-height: 18px;
font-weight: 600;
display: inline-block;
/* responsive landscape tablet */
/* responsive portrait tablet */
/* responsive portrait phone */
}
@media (min-width: 768px) and (max-width: 1018px) {
.td_top_authors .td-authors-url {
display: none;
}
}
.td_top_authors .td-authors-name a {
padding-bottom: 4px;
font-family: 'Open Sans', arial, sans-serif;
font-size: 14px;
color: #c81820;
line-height: 18px;
font-weight: 700;
display: inline-block;
font-style: italic;
}
.td_top_authors .td-authors-name a:after {
content: "";
height: 96px;
position: absolute;
right: 0;
top: -15px;
width: 324px;
/* responsive landscape tablet */
/* responsive portrait tablet */
/* responsive portrait phone */
}

@media (min-width: 1019px) and (max-width: 1140px) {
.td_top_authors .td-authors-name a:after {
width: 300px;
}
}
@media (min-width: 768px) and (max-width: 1018px) {
.td_top_authors .td-authors-name a:after {
width: 228px;
}
}
@media (max-width: 767px) {
.td_top_authors .td-authors-name a:after {
width: 100%;
}
}
.td_top_authors .td-author-post-count {
background-color: #222;
}
.td_top_authors .td-author-comments-count {
background-color: #444;
}

  • This reply was modified 7 years by arthale.
Post count: 7

$last_article = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC LIMIT 1", $td_author->ID), ARRAY_A);
$buffy .= '' . $last_article['post_title'] .'';

This code makes the problem when i try to use it like this:

Post count: 35449

Hi,

Only with your code:
https://www.screencast.com/t/VFwhnK8PEL

Results: https://www.screencast.com/t/oZBmDrDi0Lf

Thank you for your understanding.

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.