Title: PHP in a page
Last modified: August 19, 2016

---

# PHP in a page

 *  [zebrafx](https://wordpress.org/support/users/zebrafx/)
 * (@zebrafx)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/php-in-a-page/)
 * Hi all,
 * I wanted to see if I can set a page to display post of a category. I found an
   addon to run php code. I think my php coding is still lacking. I put in the if
   statement below and it not working correctly. Can somebody take a quick look 
   and let me know what I have to mod. In the example below I want to show all the
   test2 category. Thanks
 * <?php if (have_posts(in_category(‘test2’))) : while (have_posts(in_category(‘
   test2’))) : the_post(in_category(‘test2’)); ?>

Viewing 1 replies (of 1 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/php-in-a-page/#post-909851)
 * You might find that the **cat=** parameter with the [template tag](http://codex.wordpress.org/Template_Tags),
   [query_posts()](http://codex.wordpress.org/Template_Tags/query_posts), is more
   useful.

Viewing 1 replies (of 1 total)

The topic ‘PHP in a page’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/php-in-a-page/#post-909851)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
