WordPress custom function error. for help, thank you

Source: Internet
Author: User
WordPress custom function error. for help, thank you for your help. I want to make an article recommendation for each article based on the classification of the current article. the code writing function below is implemented, but there is a very serious problem, the comment has a problem. after the following code is added, the comment on the article becomes a classified comment. every article is, in addition, an error occurred while customizing the PHPcode WordPress function on other pages after the review. for help, thank you.
Wordpress for some help.
I want to make a recommendation for each article based on the category of the current article,
The code writing function below is implemented, but there is a very serious problem, that is, the comment has a problem,
After the following code is added, the comments to the article are classified comments. each article is classified, and the post-comments are changed to other pages.

PHP code
  
  
  Cat_ID. ','; // The ID of the current article category // echo $ category-> cat_name. ''; // name of the current document category} $ my_query = new WP_Query (" cat = ". $ cat_id. "& posts_per_page = 5"); while ($ my_query-> have_posts (): $ my_query-> the_post ();?>
  • "Alt =" "title =" "/> /Images/dummy.png "alt =" "title =" "/>

    "Title =" ">



  • ------ Solution --------------------
    PHP code
    $ Cat_id. = $ category-> cat_ID. ','; // The ID of the category of the current article
    ------ Solution --------------------
    "Changed to classification comment "?? Or is it the last recommendation article comment for you? After the comment, I jumped to the article?

    Check whether your $ id is changed by the loop you added.

    Discussion
    Wordpress for some help.
    I want to make a recommendation for each article based on the category of the current article,
    The code writing function below is implemented, but there is a very serious problem, that is, the comment has a problem,
    After the following code is added, the comments to the article are classified comments. each article is classified, and the post-comments are changed to other pages.

    PHP code

    // Recommended articles
    ?>


    $ Cat_id = ""......

    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.