在wordpress页面中编写php代码以显示特定的类别帖子

I am new at Wordpress. I have two pages namely 'Newsletters' and 'Service News' to show the news in my website. I want to show the posts belonging to a particular category in these pages. The page 'Newsletters' should pull all the posts belonging to category slug 'newsletters' and the page 'Service News' should pull all the posts belonging to category slug 'service-news'. How can i do so?

Somewhere i found that the following code can perform so.

<?php $catPost = get_posts(array('category' => get_cat_ID(“newsletters”))); 
$event=array_splice($catPost, 0, 1); 
foreach ($event as $post) : setup_postdata($post); 
the_content(); ?>

But on writing the code on the text editor of the page, the whole code gets shown in the page. Am i doing it wrong? Can't we write php codes in the editor. Have spent my much time in looking for this but could not solve this problem.

Please help me.

Thank you in advance

You can not write php codes in editor.

From what you want your normal archive.php should be showing the post of those two category when you visit those category url.

But if you really want to make pages for that you have to use custom page template

http://codex.wordpress.org/Page_Templates