Display post by category

I’m trying to figure out on how to display post by category in page.php. I have been searching and trying out different kinds codes but no luck. I’m still new to PHP and wordpress and just starting to code my first wordpress theme from scratch.

Here is the website i’m developing in wordpress. It’s just simple and something i can practice on.

http://zigzagadvertising.com.ph/chris/

Long back I had one such requirement and had bookmarked a link. Hope this helps you

www . riotstories . co . uk / wordpress / group-posts-by-category /

Thanks but i found the solution a few hours ago and now i have another problem.

I have created a custom page that will display posts only from a specific category and i have also set wordpress to show only 4 number of post. Now the problem is the “WP-PageNavi” is not working properly. Here is the code.

<div class=“sixteen columns latest_post”>

<?php query_posts(‘cat=3’, ‘posts_per_page=-1=-’); if(have_posts()) : while(have_posts()) :the_post(); ?>
<div class=“sixteen columns alpha omega outer_box”>
<div class=“inner_box articles”>

<!–TITLE OF THE POST –>
<h3 class=“post-title”>" rel=“bookmark” title=“Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h3>

<ul class=“data”>
<?php the_author_posts_link() ?> /
<?php the_category(', ') ?> /
<?php the_time(‘F jS, Y’) ?> /
<?php comments_number() ?>

<hr>

<!–THUMBNAIL –>
<div class=“align_thumbnail_right”>
<?php if ( has_post_thumbnail()) the_post_thumbnail(‘home-thumb’); ?>

</div>

<div class=“content”>
<!–TEXT –>
<?php the_excerpt(); ?>

"><span>Read More</span>
</div>

</div>

</div>

<?php endwhile; endif; >

<div class=“pagination”>
<?php wp_pagenavi(); ?>
</div>

</div>

I applied the plugin on the index and it seems to be working fine. But when i tried it on a custom page it doesn’t work. Really hope that someone can help me here since i’m not really good at PHP