Get custom posts loop

<?php $hacks= get_posts( array( 'post_type' => 'hacks',
                    'orderby' => 'post_title',
                    'order' => 'ASC',
));
foreach($hacks as $hack){ ?>

<li>
      <a href="/wordpress/hacks/<?php echo $hack->post_name;?>">
            <?php echo $hack->post_title; ?>
      </a>
</li>

<?php } ?>