Displaying Categories a Page
-
My WP install (currently on a local machine rather than public server) has a page called Welcome set as the front page under Settings > Reading. The posts page is set to a page called News. As you’d expect WordPress uses the theme and lays out the posts on that page.
I have another page called Local News on which I wish to display posts which are in category ID 104, aka ‘Local News.’ I have created a copy of page.php (from my theme folder) and called it localnews.php. I have set the Local News page to follow this new template.
I have taken the code from A Page of Posts only changing the top bit so it picks the right category…
if (is_page('1186') ) { $cat = array(104); } elseif ( is_page('') ) { $cat = array(); } elseif ( is_page('') ) { $cat = array(); } else { $cat = ''; }
It is displaying the posts however I have two queries.
1) It doesn’t seem to stop displaying posts; how can I set a limit and display an Older Entries link?
2) It is not formatted like the News page, do I need to copy some code from somewhere?I could put a redirect in the code to a category page however I don’t wish it to say categories and I have breadcrumbs installed so don’t wish to lose all that formatting.
If it affects anything it is a custom theme partially created in Artisteer.
I have spent two days Googling and searching these forums for something which either I can understand (my PHP knowledge is far from extensive) or works for me. There are hundreds of similar things which didn’t work for me so any help would be greatly appreciated. Thanks.
- The topic ‘Displaying Categories a Page’ is closed to new replies.