I need to link 5 posts of the same category after the content posted in WordPress. Anyone can help me? Thanks
Announce a category before the loop that will create the post category. Query Post with that cat.
Here's an example:
& lt ;? Php $ cat_id = 0; // declare that var (if_posts ()): while (is_posts ()): // Are you usually $ cat_id = $ post- & gt; Postcards; Endwhile; end if; // Here you will receive the post and the HTML output can be $ last_in_cat = get_posts ('posts_per_page = 5 & amp; cat ='. $ Cat_id); Forex currency ($ last_in_cat as cat_post):? & Gt; & Lt; A href = "& lt ;? php $ cat_post-> guid? & Gt;" & Gt; & Lt ;? Php $ cat_post- & gt; Post_title? & Gt; & Lt; / A & gt; & Lt ;? Php endforeach; ? & Gt;
Comments
Post a Comment