I have a page on my website called Work (that uses a work.php page template) set up as my front page, where I would like to display a list of the last ten posts with the custom type called portfolio. Here is my code so far:
<?php $the_query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 10 ) ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <section id="post-<?php the_ID(); ?>" <?php post_class( 'portfolio-post' ); ?>> <header> <h2><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <time datetime="<?php the_time('Y-m-d') ?>" pubdate><?php the_time('F jS, Y') ?></time> </header> </section> <?php endwhile;?>
The problem is that nothing shows up on that page, despite my having created a couple of posts of this type in wordpress' backend. And when one is clicked, I would like to be taken to
/work/the_post_i_clicked/. I must admit to being a bit confused here. Any help would be greatly appreciated.