Title: Using a function in pods template?
Last modified: March 6, 2021

---

# Using a function in pods template?

 *  Resolved [rainyh](https://wordpress.org/support/users/rainyh/)
 * (@rainyh)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/using-a-function-in-pods-template/)
 * I’m trying to make my Pods List Items widget display a list of custom post types
   but I need have a function be applied to a certain field before they’re listed.
   So far the template & function does work BUT I only get 1 item displayed, even
   though widget settings specify that 3 items should be listed.
 * This is my Upcoming Events template:
 *     ```
       <?php function fix_date_field( $time ) {
       			if (( is_numeric($time) && (int)$time == $time )) { 
       				return '<p>'. date('m-d-Y',$time) .'</p>'; 
       			} else { 
                   return '<p>'. $time .'</p>'; }
       			}
   
       ?>
   
       <li>
       <h4><a href="{@permalink}">{@title}</a></h4>
       	{@wpcf-date_time,fix_date_field}
       </li>
       ```
   
 * And these are the settings for that widget:
    Title: Upcoming Events Pod: Events
   Template: Upcoming Events Before Content: <ul class=”test”> After Content: [More Events](https://wordpress.org/events?output_format=md)
   Limit: 3
    -  This topic was modified 5 years, 3 months ago by [rainyh](https://wordpress.org/support/users/rainyh/).

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

 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/using-a-function-in-pods-template/#post-14149878)
 * Hi [@rainyh](https://wordpress.org/support/users/rainyh/)
 * You are not allowed to use PHP code within templates.
    Please add that function
   in your functions.php of your theme or in a custom plugin.
 * On the amount of items issue. If there are more items available then this should
   work fine. Do you have other filters active like a `where` clause?
 * Cheers, Jory
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/using-a-function-in-pods-template/#post-14282928)
 * Closing topic due to no reply, feel free to reopen if you still need help!
 * Cheers, Jory

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

The topic ‘Using a function in pods template?’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/using-a-function-in-pods-template/#post-14282928)
 * Status: resolved