Skip to content

Instantly share code, notes, and snippets.

@tenman
Created December 4, 2013 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenman/7785028 to your computer and use it in GitHub Desktop.
Save tenman/7785028 to your computer and use it in GitHub Desktop.
date, title, custom field value pagenate
<?php
/**
* Template Name: test category
*
* WordPress Static Page Template
*/
?>
<ul style="text-align:left">
<?php
$posts_per_page = 1;
$paged= get_query_var('paged');
if( empty( $paged ) ) {
$paged= 1;
}
if ( !isset( $posts_per_page ) ) {
$posts_per_page = get_option('posts_per_page');
}
$args= array( 'posts_per_page'=> $posts_per_page,
'paged'=> $paged,
'cat'=> 1,
'post_type' => 'post',
);
query_posts( $args );
while ( have_posts() ) {
the_post();
?>
<li>
<ul><li style="display:inline-block;width:30%;border:1px dashed #ccc;"><?php the_date();?></li>
<li style="display:inline-block;width:30%;border:1px dashed #ccc;"><a href="<?php the_permalink();?>"><?php the_title( );?></a></li>
<li style="display:inline-block;width:30%;border:1px dashed #ccc;"><?php echo get_post_meta( $post->ID, 'japanese', true ); // when custom field key 'japanese' ?></li>
</ul>
</li>
<?php
}
?>
</ul>
<?php
posts_nav_link('|', '<span class="next">< next</span>', '<span class="prev">previous ></span>');
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment