Created
December 4, 2013 09:54
-
-
Save tenman/7785028 to your computer and use it in GitHub Desktop.
date, title, custom field value pagenate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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