Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Aug 2012
    Location
    New Zealand
    Posts
    52
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Wordpress Function

    I'm currently making a function for a custom post type on wordpress which is meant to show all the users in the database via a drop down box. the thing is its not working and is just showing a blank page when I look at the error_log there are no errors... Any help?

    PHP Code:
    <?php
            
    function cpt_events_add() {
        global 
    $post;
        
    // Noncename needed to verify where the data originated
            // Also creates the meta box
        
    echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .
        
    wp_create_nonceplugin_basename(__FILE__) ) . '" />';
        
    // Get the user data if its already been entered and also show the useres withing the database
        
    $add get_post_meta($post->ID'_add'true);
        
    $order 'user_nicename';
        
    $users $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY $order"); // query users
        
    echo '<select>';
            foreach(
    $users as $user) : // start users' profile "loop"
            
    echo '<option value="'$add .'" name="_add">.'<?php echo $user->user_firstname?>.'</option>';
        endforeach;
        echo '</select>'; 
     
        
        
    }
    ?>
    There is a proper function for this which can be found here
    http://codex.wordpress.org/Function_...dropdown_users
    Last edited by Jordann; 10-19-2013 at 07:01 AM. Reason: Resolved


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •