Skip to content

Instantly share code, notes, and snippets.

@rslonik
Last active August 29, 2015 14:00
Show Gist options
  • Save rslonik/11262213 to your computer and use it in GitHub Desktop.
Save rslonik/11262213 to your computer and use it in GitHub Desktop.
<?php
/** Code for custom loop */
function my_custom_loop() {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// WP_Query arguments
$args = array (
'post_type' => 'any',
'category_name' => 'hall-dos-aprovados',
'pagination' => true,
'paged' => $paged,
'posts_per_page' => '10',
);
// The Query
$wp_query = new WP_Query( $args );
// The Loop
if ( $wp_query->have_posts() ) { ?>
<div class="archive-description taxonomy-description"><h1 class="archive-title">Hall dos aprovados</h1><p>Foi aprovado e quer deixar também seu depoimento? <a href="http://www.aprovaconcursos.com.br/noticias/hall-dos-aprovados/eu-fui-aprovado/">Clique aqui</a>.</p>
</div>
<?php while ( $wp_query->have_posts() ) {
$wp_query->the_post();
?>
<div class="post type-post status-publish format-standard hentry category-hall-dos-aprovados entry">
<?php if('aprovados' == get_post_type()) {
echo '<a href="'.get_permalink().'"><h2 class="entry-title">'.get_post_meta( get_the_ID(), 'post_title', true ).' passou no concurso '.get_post_meta( get_the_ID(), 'post_concurso', true ).'</h2></a>';
} else { ?>
<h2 class="entry-title"><a href="<?php the_permalink();?>" title="<?php the_title();?>”" rel="bookmark"><?php the_title();?></a></h2>
<?php } ?>
<div class="post-info">
<span class="date published time" title="<?php the_date(); ?>"><?php echo get_the_date('d-m-Y'); ?></span> por <?php the_author_posts_link(); ?> <a href="<?php comments_link(); ?>">Deixar um Comentário</a> <?php edit_post_link('Editar','(',')'); ?></div>
<div class="entry-content"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<img width="250" height="80" src="http://wp.aprovaconcursos.com.br/noticias/wp-content/uploads/2014/04/Eu-fui-aprovado-2501-250x80.jpg" class="alignleft post-image entry-image" alt="Eu-fui-aprovado-250" itemprop="image"></a>
<p><?php the_excerpt(); ?> &nbsp; &nbsp;</p>
</div></div>
<?php
}
?><ul>
<li><?php previous_posts_link( '&laquo; PREV', $wp_query->max_num_pages) ?></li>
<li><?php next_posts_link( 'NEXT &raquo;', $wp_query->max_num_pages) ?></li>
</ul><?php
} else {
echo ' no posts found';
}
echo 'oi'; ?>
<?php
// Restore original Post Data
wp_reset_postdata();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment