Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7535527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:19:31+00:00 2026-05-30T06:19:31+00:00

This is my first time posting a question here, it has been a valuable

  • 0

This is my first time posting a question here, it has been a valuable resource before so I thought maybe someone would be able to answer my question.

It might be a simple solution, but as I said already, I’m a PHP noob. Forgive me.

Here is my code:

    <?php wp_reset_postdata(); // reset the query ?>
<?php $authorposts = get_the_author_posts();
    if ($authorposts < 1) {
    echo " ";
    }
    else { ?>
<div class="single-sidebar"><!--expert_blog start-->
    <div class="single-sidebar-middle">
    <div class="single-sidebar-top">
    <h3>More Posts by <?php the_author();?></h3>
    </div>
    <p><?php echo get_related_author_posts(); ?></p>
    <div class="single-sidebar-bottom">
        <div class="more_blog"><a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>">+ Read more</a></div>
    </div>
    </div>
</div>
<div class="clear"></div>
<?php wp_reset_postdata(); // reset the query ?>

What this is supposed to do: get the number of posts by a particular author (of the post currently being viewed), and output it into a conditional statement saying if it is 1 or less than 1, display nothing. Otherwise, display the titles of each post.

What happens: The divs show up even when there is only one post attirbuted to the author, but nothing shows up in the list (im guessing because there is only one post and you are already viewing it).

Any help would be appreciated, it is late and my brain has melted. Please let me know if anything needs clarification.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:19:32+00:00Added an answer on May 30, 2026 at 6:19 am

    Instead of if ($authorposts < 1) it should be if ($authorposts <= 1)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First time posting, please let me know if this question has already been answered!
this is my first time posting here, I have a question which I have
this is my first time posting a question here - I've searched for ones
this is my first time posting on here and have read alot of helpful
First time posting here, will try to be succinct. This is a classic 'can't
This is the first time I am posting a question on stackoverflow, so please
First time posting on here, so I hope I do this correctly, however I
A question like this has been asked differently several times. Yet here i am.
this is my first time ever posting a question and I am kind of
This is my first time posting on Stackoverflow, but I've been reading through many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.