Created
April 29, 2014 07:00
-
-
Save ozh/11392560 to your computer and use it in GitHub Desktop.
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 | |
// Front page - just tweets, no reply | |
?> | |
<?php get_header(); ?> | |
<?php | |
// WP_Query arguments | |
/**/ | |
// global $paged; var_dump( $paged ); var_dump( get_query_var('paged') ); | |
$paged = get_query_var('paged') ? get_query_var('paged') : 1; | |
$args = array ( | |
// 'cat' => -0, | |
'pagination' => true, | |
// 'posts_per_page' => '5', | |
'paged'=> $paged, | |
'meta_query' => array( | |
array( | |
'key' => 'ozh_ta_reply_to_tweet', | |
'compare' => 'NOT EXISTS', | |
), | |
), | |
); | |
query_posts( $args ); | |
/**/ | |
?> | |
<?php if (have_posts()) : ?> | |
<!-- !BEGIN #tweets --> | |
<div id="tweets"> | |
<h2>Recent tweets <?php if( $paged > 1 ) echo "« page $paged"; ?></h2> | |
<?php while (have_posts()) : the_post(); ?> | |
<div <?php post_class() ?> id="post-<?php the_ID(); ?>"> | |
<div class="tweet <?php echo otat_get_tweet_style(); ?>"> | |
<?php the_content(); ?> | |
</div> | |
<?php get_template_part( 'post_meta' ); ?> | |
</div> | |
<?php endwhile; ?> | |
<div class="pagination"> | |
<div class="older"><?php next_posts_link('« Older tweets', $wp_query->max_num_pages) ?></div> | |
<div class="newer"><?php previous_posts_link('Newer tweets »') ?></div> | |
</div> | |
</div> | |
<!-- END #tweets --> | |
<?php | |
// clean up after our query | |
wp_reset_query(); | |
?> | |
<?php else : ?> | |
<h2>No posts found</h2> | |
<?php get_search_form(); ?> | |
<?php endif; ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment