WordPress comment and Recommendation block location, will be wrong

Source: Internet
Author: User
Tags php source code
WordPress comment and Recommendation block location, will be wrong
On the single.php page of WordPress
I would like to join a recommendation section. is to query a similar article based on the classification ID of the current article and then as a recommendation
But
PHP Code
  
   
  
   
  
   

If so, the page is not a problem, but the recommended article in the comments below the layout is not good to see
If I change into
PHP Code
  
   
  
   
  
   


The recommended article is on the list of comments, but the question comes. If you recommend it, the comment will be wrong.
For example: Read the comment is not normal, the comment is not the current article of the review, but into the current classification of the comments.
Comments_template (); It should be WordPress inside all the page, I will not write it out.
I'm pasting recommend.php source code.
PHP Code
  
   
  
   $cat _id, ' showposts ' =>5); $my _query = new Wp_query ($args); while ($my _query->have_posts ()): $my _query->the_ Post ();? >
  • "alt=" "title=" "/> /images/dummy.png" alt= "" title= " "/>

    "Title=" " >



  • In the source code, the Lima error occurs whenever a while loop or foreach is used.
    I don't know what to do with it. The possible error occurs because the loop changes the ID: And then I don't know what to do.

    ------Solution--------------------
    No, you have no problem with the code.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.