Wordpress comment is different from the recommended block location, and an error occurs.

Source: Internet
Author: User
If the location of the wordpress comment is different from that of the recommendation block, an error occurs in the wordpress single. on the php page, I want to add a recommended content section. queries a similar article based on the Category ID of the current article and then serves as a recommendation, but PHPcode & lt ;? Phpcomments_template ();? & Gt; & lt ;? Phpinc wordpress comments and recommended block locations are different, and errors will occur.
On the wordpress single. php page
I want to add a recommendation content section, which is to query similar articles based on the classification ID of the current article and then serve as a recommendation.
However
PHP code
  
  
  

In this case, there is no problem with the page, but it is hard to see the layout of the recommendation article below the comment.
If I change
PHP code
  
  
  


The recommendation article is on the comment list, but the problem arises. as long as the recommendation is on the comment list, the comment will be wrong.
For example, the read comment is not normal, and the comment is not the current article of the comment, but the comment of the current category.
Comments_template (); it should be a page in wordpress and I will not write it out.
I posted the source code for recommend. php.
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, when a while loop or foreach is used, Lima fails.
    I don't know how to solve the problem. the possible error is that the ID is changed by the loop .. Then I don't know how to do it.

    ------ Solution --------------------
    No, no problem with your 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.