Advertisement
petehayman

Debut Code

Nov 5th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.49 KB | None | 0 0
  1. <p>
  2.                         <strong>Debut:</strong>
  3.                         <?php
  4.                         global $wpdb;
  5.                         global $post;
  6.                         $querystr = "
  7.                         SELECT DISTINCT p.*
  8.                         FROM $wpdb->posts p
  9.                             INNER JOIN $wpdb->postmeta pm ON pm.post_id = p ON p.ID
  10.                             INNER JOIN $wpdb->postmeta pm2 ON pm2.post_id = p ON p.ID                          
  11.                         WHERE pm.meta_key = ('PL1','PL2','PL3','PL4','PL5','PL6','PL7','PL8','PL9','PL10','PL11')
  12.                             OR ((
  13.                             pm.meta_key IN ('PL12',  'PL13',  'PL14',  'PL15',  'PL16',  'PL17',  'PL18')
  14.                             AND pm.meta_value = %d
  15.                             )
  16.                             AND (
  17.                             pm2.meta_key IN ('si12','si13','si14','si15','si16','si17','si18')
  18.                             AND ( SUBSTR(pm2.meta_key, 3) = SUBSTR(pm.meta_key, 3) )
  19.                             AND pm2.meta_value+0 > 0
  20.                             ))
  21.                             AND pm.meta_value = $playerID
  22.                             AND p.post_type = 'match'
  23.                         ORDER BY p.post_date ASC
  24.                         LIMIT 1
  25.                         ";
  26.                        
  27.                         $debut = $wpdb->get_results($querystr, OBJECT);
  28.                        
  29.                         if ($pageposts):
  30.                             global $post;
  31.                                 foreach ($pageposts as $post):
  32.                                 setup_postdata($post);
  33.                        
  34.                                 ?>
  35.                                     vs. <?php $opposition = get_field('club'); if($opposition) echo $opposition->post_title;?>  (<?php the_field('venue'); ?>, <a href="<?php the_permalink(); ?>"><?php the_field('score'); ?></a>), <?php echo get_the_date('d-m-Y'); ?>
  36.                            
  37.                             <?php endforeach; else: ?>
  38.                                     No Debut
  39.                         <?php endif; wp_reset_postdata(); ?>
  40.                     </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement