Displaying a Single WordPress Category

In my case, the output of a separate category was needed to display news on the main page, because the page was not standard, then the usual way of output did not suit me, and besides the news, there was also a section of projects.

To display a separate category in WordPress, I found an interesting code. I use and recommend. Very comfortably.

That is, we get all records with the condition we need get_posts(‘category=1&numberposts=3’) into an object $posts_new. Further, we just go around it in a loop and display the records we need.

More about the function get_posts() read here

If this information is not enough, read about the function $wpdb->get_results().

You can also read about the output of a separate category in WordPress here.:

 


Купить хостинг WordPress
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

8 Responses

  1. Vitaly Bidenko says:

    What means “j.m.�”
    http://clip2net.com/s/5IJ3qj

  2. Vitaly Bidenko says:

    HM. still not working on my site. Somewhere the syntax is wrong, something else. It's a pity, much needed piece – the situation is banal – in three places you need three different headings. You will have to install three different plugins.

  3. Vitaly Bidenko says:

    Все, Thanks a lot, figured out, the whole problem was in the copied quote “’”, when he took it over – everything worked great

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal