Guest User

Untitled

a guest
May 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. // Admin post meta contents
  2.     function meta_guest_selection()
  3.     {
  4.         global $post;
  5.         //include_once('helpers.php');
  6.         $custom = get_post_custom($post->ID);
  7.         $idealien_guest_selection = $custom["idealien_guest_selection"];
  8.         ?>
  9.  
  10.         <style type="text/css">
  11.         label.guest {
  12.             font-weight: bold;
  13.             width: 7.5em;
  14.             float: left;
  15.         }
  16.    
  17.         span.addInfo {
  18.             margin-left: 7.5em;
  19.             font-style: italic;
  20.        
  21.         }
  22.  
  23.         .guest_inputLine {
  24.             width: 80%;
  25.             float: left;
  26.         }
  27.    
  28.         #wpcontent .select_inputLine { height: auto; }
  29.    
  30.         </style>
  31.    
  32.         <p>
  33.             <label class="guest">Guest(s):</label>
  34.             <?php // Get all guests (custom post type)
  35.                
  36.                 /*
  37.                 $guestOptions = new WP_Query();
  38.  
  39.                 $guestOptions->query('post_type=guest&posts_per_page=-1&orderby=title&order=ASC');
  40.                
  41.                 if ($guestOptions->have_posts()) :
  42.                     echo "<select MULTIPLE='multiple' size=8 class='select_inputLine' name='idealien_guest_selection[]'>";
  43.                    
  44.                     while ($guestOptions->have_posts()) : $guestOptions->the_post();
  45.                         if (in_array(get_the_title(),$idealien_guest_selection)) {
  46.                             echo "<option SELECTED>" . get_the_title() . "</option>\n";
  47.                         } else {
  48.                             echo "<option>" . get_the_title() . "</option>\n";
  49.                         }
  50.                        
  51.                     endwhile;
  52.                    
  53.                     echo "</select>";
  54.                
  55.                 endif;
  56.                
  57.                 wp_reset_postdata();
  58.                 */
  59.                
  60.                
  61.                 //global $post;
  62.                 $args = array( 'post_type' => 'guest', 'posts_per_page'=> -1, 'orderby' => 'title' );
  63.                 $myposts = get_posts( $args );
  64.                 foreach( $myposts as $post ) :  setup_postdata($post);
  65.                     echo '<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>';
  66.                 endforeach;
  67.                 wp_reset_postdata();
  68.             ?>
  69.  
  70.         </p>
  71.     <?php
  72.     }
Add Comment
Please, Sign In to add comment