How to Get the Dynamic Categories related Posts

How to  Get the Dyanmic Categories:

Here small snippet code is avialble for get categories related  posts

1. You have to give the page name and category name should be same

2. Add below code where you want..and than refresh page . you will get the post related categories.

<?php query_posts('category_name='.get_permalink().'&post_status=publish,future');?>