Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

morsiiii on "custom classes in WP 3.8 stop working"

$
0
0

Hi, i was using a custom class to view latest 5 contributors it was working before i upgrade to 3.8 plz any help to fix the code

<?php
//list 6 latest contributors
$authors =  array();
$count = 0;
$args=array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {

  while ($my_query->have_posts() && $count < 5) : $my_query->the_post();
    $author_id=$my_query->post->post_author;
    $user = new WP_User( $author_id );
    if ( !empty( $user->roles ) && is_array( $user->roles ) && !in_array('administrator',$user->roles)) {

      if (!in_array($author_id,$authors)) { ?>
        <?php echo '<p>'; ?>

        <div class="post-thumbnail">
        <a href="<?php the_permalink();?>">
        <img src="<?php bloginfo('template_url'); ?>/images/opinion/<?php echo $user->first_name ?>.jpg" alt="" class="avatar photo" height="60" width="60"/></a></div>
		          <?php if($user->deporte) { ?>
          <?php echo $user->deporte; ?>
          <?php } ?>
        <h3> <a href="<?php the_permalink();?>"><?php the_title(); ?></a></h3>
		<?php the_author_posts_link(); ?>

        <?php echo '</p>'; ?>

		<?php $count++;
        $authors[]=$author_id;
      }
    }
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles