0

I am beginner in wordpress, I want to assign my categories that contain multiple posts to particulate page.

So please, anybody guide me?

6
  • what you mean by assign ? do you want to display them ? Commented Jan 12, 2015 at 7:33
  • I wont to display them in the page.
    – Lucky
    Commented Jan 12, 2015 at 7:34
  • all posts with respective categories ? Commented Jan 12, 2015 at 7:37
  • I Wont to display all post that I assign to the particulate page. for exp., if my page name service and my category name food than all food category post display on page Service.
    – Lucky
    Commented Jan 12, 2015 at 7:42
  • look at my answer. Modify according to your needs. Commented Jan 12, 2015 at 7:45

1 Answer 1

-2

You can create a page template (for service page) and then set it to particular page, on which you want to display posts.

After that open page template and paste below code where you wan to show posts.

<?php
query_posts('cat=1'); // cat=1 , id of category you want to show (e.g. cat id of food category )
while (have_posts()) : the_post(); // loop for posts with category id = 1 
the_content(); // print content of all founded posts
endwhile; // end loop.
?>

Refer this for more help

3
  • 2
    Recommending the use of query_posts for secondary loops is really bad idea. Use WP Query instead.
    – cybmeta
    Commented Jan 12, 2015 at 7:51
  • question doesnt specifies about this, why negative ? Commented Jan 12, 2015 at 7:53
  • 1
    query_posts is a really bad function to use as it breaks the main query, rerun queries, is slow and totally stuffs up pagination and the globals like $post and $wp_query. It fact, query_posts breaks a lot of functionality. Never ever use it. Commented Jan 12, 2015 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.