Title: [Plugin: People Lists] Executing PHP in a template
Last modified: August 19, 2016

---

# [Plugin: People Lists] Executing PHP in a template

 *  [JamTheMan](https://wordpress.org/support/users/jamtheman/)
 * (@jamtheman)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/)
 * Hi
 * I am working on creating a user list using your plugin, and so far it works great!
 * I just can’t seem to get the last pieces of the puzzle to match my needs. I would
   really like to be able to exec some PHP within the template (I have the Exec 
   PHP plugin installed). More precisely, I would like have a line like this work
   from inside the template:
 * <?php echo get_user_meta( %id%, ‘weapon’, true); ?>
 * Using %id% as one of the defaults you supply. I know I could just make the “weapon”
   field as an added field through your plugin, but it has already been made for
   all my users, and reconfiguring all of them would be a bore. Can this be done?
 * Thx,
    JamTheMan

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [JamTheMan](https://wordpress.org/support/users/jamtheman/)
 * (@jamtheman)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005154)
 * BTW…
 * The real problem is that somewhere the PHP gets caught and put into a comment
   instead, and therefore is not received by the Exec PHP plugin.
 * The Chrome Inspector shows this line instead:
 * <!–?php echo get_user_meta( %id%, ‘weapon’, true); ?–>
 *  Plugin Contributor [Enej Bajgorić](https://wordpress.org/support/users/enej/)
 * (@enej)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005342)
 * Hi JamTheMan
 * I don’t think you need to do that.
    There is a way to create custom user meta
   fields in the user profile. and to display them in the template. Have you figured
   out how to do that? Let me know if the UI is not so straight forward.
 * Cheers
 *  Thread Starter [JamTheMan](https://wordpress.org/support/users/jamtheman/)
 * (@jamtheman)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005343)
 * Yeah… I now that… And that btw works great!
 * The thing is just that I already have all the extra user details added to the
   WordPress profiles, with another plugin, and it would therefore be much easier
   if i could use those values in your plugin, instead of remaking them all…
 * This of cause could be done with some rather simple SQL updates, but then it 
   would be great if all the custom meta fields were not added under “Contact Info”
   in the user profile, but maybe under a new node called “Other Info” or something.
   Just makes more sense to the users in case the new fields have nothing to do 
   with contact info…
 * So if there is no way to allow the PHP to go through, I’ll just have to do it
   the other way. Thanks in any case—
 * -Jam
 *  Plugin Contributor [Enej Bajgorić](https://wordpress.org/support/users/enej/)
 * (@enej)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005347)
 * Hi Jam
 * I am thinking about adding a filter to the plugin that will allow you to add 
   your own tags and quiery the stuff easier in your case. This way you will be 
   able to extend the plugin for your needs and not worry about modifying it for
   the future case. I will write a short tutorial that will do that. Would that 
   work for your case?
 * Cheers Enej
 *  Thread Starter [JamTheMan](https://wordpress.org/support/users/jamtheman/)
 * (@jamtheman)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005351)
 * Yeah, that sounds like it would be perfect…
 * Thanks so much 😀
 *  [aplussideas](https://wordpress.org/support/users/aplussideas/)
 * (@aplussideas)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005428)
 * Hi Enej,
 * Congrats on the great plug-in. I have the exact same need as Jam (to have the
   ability to render a shortcode from another plug-in into the template).
 * You mentioned you were working on adding a filter and writing a short tutorial
   on how to use this. Have you made any progress on this?
 * Thanks!!
 *  Plugin Contributor [Enej Bajgorić](https://wordpress.org/support/users/enej/)
 * (@enej)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005429)
 * Hi aplussideas and Jam
 * I am sorry I didn’t post some sort of tutorial earlier. If you look at the code
   and are compftable with filters. you can use the
    ‘people_list_shortcode’ filter
   to change the html that is being ouputed to the theme.
 * try something like
 *     ```
       add_filter('people_list_shortcode','example_people_list_shortcode',10); //
       function example_people_list_shortcode($html){
       return $html."the end of the template";
       };
       ```
   
 * you can also try the ‘people_list_fields_display’ filer
    and the ‘people_list_custom_fields’
 * look at the code in the file people-list.php starting at line 726 for more info.
 * I hope that helps

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: People Lists] Executing PHP in a template’ is closed to new 
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/people-lists.svg)
 * [People Lists](https://wordpress.org/plugins/people-lists/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/people-lists/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/people-lists/)
 * [Active Topics](https://wordpress.org/support/plugin/people-lists/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/people-lists/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/people-lists/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Enej Bajgorić](https://wordpress.org/support/users/enej/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-people-lists-executing-php-in-a-template/#post-2005429)
 * Status: not resolved