Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9102801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:28:06+00:00 2026-06-17T01:28:06+00:00

I have two pods: course and teacher . Each course has a teacher .

  • 0

I have two pods: course and teacher.

Each course has a teacher.

I use shortcodes in order to build a form to define new course:

[pods name='course' form='1' fields='name, teacher' ]

When defining a new course, the user can choose the teacher for this course.

By default, the name of the teacher is displayed in a drop down list. I wonder if I can change the output of the teachers in the drop down list.

For example, in addition to the name I want to display a certain field, such as location of the teacher in the drop down list.

Is this possible using the built-in shortcodes of Pods 2?


Update:

Following the instructions of Scott, I solved the problem. I wrote the solution into the comment section but formating was lost. Below, I put the code again:

function pods_teacher_pick_data($data, $name, $value, $options, $pod, $id){
    if ($name == "pods_field_teachers") {
        foreach ($data as $id => &$value) {
            $p = pods('teacher', $id);
            $name = $p->display('name');
            $city = $p->display('profile.city.name');
            $value = $name . ' - ' . $city;
        }
    }
    return $data;
}

add_filter('pods_field_pick_data', 'pods_teacher_pick_data', 1, 6);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:28:07+00:00Added an answer on June 17, 2026 at 1:28 am

    Not built in yet, but you can take over the data output using the filter: pods_field_pick_data

    $data = apply_filters( 'pods_field_pick_data', $data, $name, $value, $options, $pod, $id );
    

    Adding a filter to that filter should give you the ability to change what appears in the drop-down, or other relationship input types.

    Edit: I just added a similar filter for filtering the autocomplete data too.

    $pick_data = apply_filters( 'pods_field_pick_data_ajax', array(), $field[ 'name' ], null, $field, $pod, 0, $data );
    

    $data in this array is actually the fully setup PodsData object

    EDIT (02/07/2013):

    In Pods 2.3, I’ve added a quick function that should streamline adding custom relationship objects. This is preferrer over overriding an existing relationship or using the custom simple definition dynamically. Pretty easy to use, check it out at https://github.com/pods-framework/pods/issues/1033

    $options = array(
        'group' => 'Special Relationships', // Whatever you want the selection group to be, defaults to label
        'simple' => false, // Whether this field is related by strings or integer IDs, integer IDs get stored in wp_podsrel, strings are stored in the field itself either serialized (meta-based) or json encoded (table-based)
        'data' => array( // Custom define the items to select from manually
            1 => 'Gravity Form 1',
            2 => 'Gravity Form 2'
        ),
        'data_callback' => 'get_custom_gravity_forms_list', // Provide a callback function to call to define the data (instead of setting 'data' above)
        'value_to_label_callback' => 'get_custom_gravity_forms_list', // Provide a callback function to define the data when called through PodsField_Pick::value_to_label
        'simple_value_callback' => 'get_custom_gravity_forms_list' // Provide a callback function to define the data when called through PodsField_Pick::simple_value
    );
    
    pods_register_related_object( 'gravity-form', 'Gravity Forms', $options );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Pods: course participant The pod course has a PICK field to
I have two vectors, x and y . x is a vector where each
I have two columns in a table (A and B). Column A has an
I have two records with the same fields and one of them has a
I have two columns, the first column will have the name of a object,
Have two bean definitions: file a.xml <bean id=A class=com.A> <property name=bClass ref=B/> </bean> file
I have two models team and fixture . The fixture model has two columns
Have two tables named Employee and Order. The relations between the tables Employee (1)
have two classes, A and B, where B extends A and has one attribute
I have two tables imagesgroup and images imagesgroup has following fields id and group_name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.