How do I list posts in certain categories on related pages?
-
Please help!
I am designing a site that is a mixture of pages and posts (mostly news items and factsheets). What I would like to do is to have a list of related posts in the sidebar on relevant pages.
eg: on the community law pages, I would like the community law factsheets and community law news items to be listed in the sidebar. On the employment law pages, I would like the employment law post items to be listed in the sidebar.
I can do this with NAVT lists, but I really want to avoid using javascript if at all possible. So I need code that will do the following:
If the page parent/page grandparent ID of this page is (community law) then list the posts that exist under the following (community law) categories.elseif the page parent/page grandparent ID of this page is (employment law) then list the posts that exist under the following (employment law) categories.
and so on to endif.
I am nearly there with the logic, but I just can’t get there with the code…If someone can give me the php code for that, I will buy them a virtual drink of their choice. Thanks!
The topic ‘How do I list posts in certain categories on related pages?’ is closed to new replies.