Guest User

Untitled

a guest
Apr 27th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.79 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Agents List
  4. */
  5. ?>
  6.  
  7. <?php
  8.  
  9. if( isset( $_REQUEST['vCard'] ) ) {
  10.  
  11.     $filename = strtolower( preg_replace( '/W+/', '_', $_REQUEST['vCard'] ) );
  12.    
  13.     // Set headers to force download       
  14.     $now = gmdate('D, d M Y H:i:s') . ' GMT'; // Header expires      
  15.     header("Content-Type: text/x-vCard");
  16.     header("Content-Disposition: attachment; filename=" . $filename . "");
  17.     header("Connection: close");
  18.     header('Expires: ' . $now);
  19.     header("Pragma: no-cache");
  20.    
  21.     makeVcard();
  22.     exit;  
  23. }  
  24.  
  25.  
  26.  ?>
  27.  
  28. <?php get_header(); ?>
  29.    
  30.     <article id="leftcol" class="left">
  31.    
  32.         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  33.                        
  34.             <div id="">
  35.                 <h1><?php the_title(); ?></h1>
  36.                 <?php the_content(); ?>
  37.                
  38.                 <?php
  39.  
  40.                     global $wpdb;
  41.                     $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename";
  42.                     $author_ids = $wpdb->get_results($query);
  43.                    
  44.                     foreach($author_ids as $author) : $curauth = get_userdata($author->ID);
  45.                
  46.                         if($curauth->user_level >= 0 && $curauth->user_level != 10) : $user_link = get_author_posts_url($curauth->ID); ?>  
  47.                        
  48.                         <div class="listing authorarchive left">
  49.                             <?php if($curauth->ct_profile_url) { ?>
  50.                                 <div class="imgwrapagent left marginRight">
  51.                                     <img id="authorimg" src="<?php bloginfo('template_directory'); ?>/img_resize/timthumb.php?src=<?php echo $curauth->ct_profile_url; ?>&h=198&w=158&q=100" />
  52.                                 </div>
  53.                             <?php } ?>
  54.                                      
  55.                             <div class="textwrapagent left">
  56.                                
  57.                                 <h2><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a></h2>
  58.                                
  59.                                     <?php if($curauth->tagline) { ?><h4><?php echo $curauth->tagline; ?></h4><?php } ?>
  60.  
  61.                                     <h5><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">View All Listings</a></h5>
  62.  
  63.  
  64.                                      <ul class="authorDetails left">
  65.                                      
  66.                                             <li class="authorPhone"><?php if($curauth->phone) { ?><?php echo $curauth->phone; ?><?php } ?>
  67.                                             </li>
  68.                                            
  69.                                             <li class="authorFax"><?php if($curauth->fax) { ?><?php echo $curauth->fax; ?><?php } ?>
  70.                                             </li>
  71.                                            
  72.                                             <li class="authorEmail"><?php if($curauth->user_email) { ?><a href="mailto:<?php echo $curauth->user_email; ?>" title="E-mail<?php echo $curauth->display_name; ?>"><?php echo $curauth->user_email; ?></a><?php } ?>
  73.                                             </li>
  74.                                            
  75.                                             <li class="authorVcard">
  76.                                                 <?php $author_vCard = strtolower( preg_replace( '/W+/', '_', $curauth->display_name ) );
  77.                                                 <a href="<?php echo add_query_arg( 'vCard', $author_vCard ); ?>">Download Contact Info</a>
  78.                                             </li>
  79.                                            
  80.                                            
  81.                                      </ul>
  82.                              </div>
  83.                            
  84.                             <div class="clear"></div>
  85.                            
  86.                             <?php if($curauth->description) { ?><p class="bio"><?php echo $curauth->description; ?><?php } ?>
  87.                                
  88.                         </div>
  89.                
  90.                         <?php endif; ?>
  91.                
  92.                     <?php endforeach; ?>      
  93.            
  94.             </div>
  95.        
  96.         <?php endwhile; endif; ?>
  97.    
  98.     </article>
  99.    
  100.     <?php get_sidebar(); ?>
  101.  
  102. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment