Take only one field from a one custom post.
-
I put together a solution that is already working with the Custom Post UI, however Pods works better for me, so I want to migrate to it.
My code working correctly today with CPT UI is:
function course_settings($config) { $terms = get_the_terms( get_the_ID(), $config ); $lista_nomes = null; $list = array(); foreach ( $terms as $term ) { $list_names[] = $term->name; } $list_done = join( ", ", $lista_nomes ); return $lista_done; }
So I tried to do the same thing with Pods, but it is returning all fields from all custom posts in my $ config parameter.
function course_settings_pods($config) { $params = array(); $mypod = pods( 'course_2',$params); $list=array(); while ( $mypod->fetch() ) { $list[]=$mypod->field( $config ); } $list_done = join( ", ", $list ); return $lista_done;
I don’t know how to make it return only the fields of the current post. Can someone help me?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Take only one field from a one custom post.’ is closed to new replies.