Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter obsolite

    (@obsolite)

    I know there’s a rule against bumping your own posts but I just wanted to return to say I found the solution. New code posted below:

    <table class="table" >
    						<?php
    						$numPosts = 0;
    						$popularpost = stats_get_csv( 'postviews', array( 'days' => -1, 'limit' => 100 ) );
    						foreach ($popularpost as $post){
    							$aux = get_post_meta($post['post_id'], 'wpb_post_views_count', true);
    							$price = get_post_meta($post['post_id'], 'post_price', true);
    							if(!empty($aux) && !empty($price) && $numPosts < 10){
    								$numPosts++;
    								$author_id = get_post_field( 'post_author' , $post['post_id']);
    								$author_url = get_the_author_meta( 'nicename', $author_id );
    								$author = get_the_author_meta( 'display_name', $author_id );
    								$listThumb = get_the_post_thumbnail( $post['post_id'] );
    						?>
    
    								<tr>
    									<td><a href="<?php echo $post['post_permalink']; ?>"><?php echo $listThumb; ?></a></td>
    									<td><a href="<?php echo $post['post_permalink']; ?>"><?php echo $post['post_title']; ?></a></td>
    									<td><a href="./author/<?php echo $author_url; ?>"><?php echo $author; ?></a></td>
    									<td><?php echo $price; ?></td>
    								</tr>
    					<?php
    							}
    						}
    					?>
    					</table>

    Hope this helps anyone who was also in my position.

Viewing 1 replies (of 1 total)