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.