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 6659505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:02:33+00:00 2026-05-26T02:02:33+00:00

I am trying fit wordpress into my website, and instead of creating a theme,

  • 0

I am trying fit wordpress into my website, and instead of creating a theme, I am just making use of the APIs to put the blogs onto my website. I am stuck with getting comments. When I call$comments = get_comments(array(‘post_id=>’.$post->ID,’order’ => ‘ASC’)); I get comments for all posts.
I am not a PHP developer, I am just learning now. I am a java developer actually.. Anyway here’s the code that doesnt work:

<?php global $more; 
$more = -1;
$posts = get_posts('numberposts=10&order=ASC');
$counter=0; 
foreach ($posts as $post) {
    setup_postdata($post);?>

    <div class="article">
        <h2><?php the_title(); ?></h2>
        <div class="clr"></div>
        <h3><?php the_time('F j, Y'); ?></h3>
        <div id="content<?php echo $counter; ?>" class="section sectionborder">
            <?php the_content(); ?>
            <h2>Post ID:<?php echo $post->ID?></h2>

            /**
            * This is where I call get_comments and the post is being passed
            * correctly to it. Since the post ID is printed correctly above. But
            * I am getting comments not related to this post as well
            */

            <?php 
                $comments = get_comments(array('post_id=>'.$post->ID,'order' => 'ASC'));
                echo '<h3>Comments</h3>';
                foreach($comments as $comment) :
                    echo('<div class="comment">'
                        .$comment->comment_content.
                        '<span class="comment-author">-'. $comment->comment_author. '</span>
                        &nbsp;<span class="comment-date">'.date('Y-m-d H:i', strtotime($comment->comment_date)) .'</span>
                    </div>');
                endforeach;
            ?>


        </div>           
        <div id="a<?php echo $counter; ?>">
            <a href="#">Read More</a>                     
        </div>  
    </div>
    <br/>
    <hr/>   
    <?php $counter++; ?>
<?php } ?>  
  • 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-26T02:02:34+00:00Added an answer on May 26, 2026 at 2:02 am

    I don’t know about wordpress, but you have an error here which could cause that problem:

    array('post_id=>'.$post->ID,'order' => 'ASC')
    

    Should be:

    array('post_id' => $post->ID, 'order' => 'ASC')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find myself always trying to fit everything into the OOP methodology, when I'm
I'm trying to fit an image into a <td> that is smaller than the
I'm developing a wordpress theme locally and I'm trying to set a base URL
Im trying to fit a swimming pool onto this piece of terrain. The terrain
I am trying to make form elements fit into a visual style with other
I'm just trying to put a background image on a webpage with 100% width
I am trying to implement a linear least squares fit onto 2 arrays of
I've been working on my non-profit's website, trying to fit our loooong dropdown menus
im trying to make my images fit nicely into screen without overlapping but no
I am trying to fit a 2-bit 2-to-1 mux into one LUT. It seems

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.