| @@ 1284-1301 (lines=18) @@ | ||
| 1281 | * |
|
| 1282 | * @since 2.1 |
|
| 1283 | */ |
|
| 1284 | function pods_field ( $pod, $id = false, $name = null, $single = false ) { |
|
| 1285 | // allow for pods_field( 'field_name' ); |
|
| 1286 | if ( null === $name ) { |
|
| 1287 | $name = $pod; |
|
| 1288 | $single = (boolean) $id; |
|
| 1289 | ||
| 1290 | $pod = get_post_type(); |
|
| 1291 | $id = get_the_ID(); |
|
| 1292 | } |
|
| 1293 | ||
| 1294 | $pod = pods( $pod, $id ); |
|
| 1295 | ||
| 1296 | if ( is_object( $pod ) ) { |
|
| 1297 | return $pod->field( $name, $single ); |
|
| 1298 | } |
|
| 1299 | ||
| 1300 | return null; |
|
| 1301 | } |
|
| 1302 | ||
| 1303 | /** |
|
| 1304 | * Get a field display value from a Pod |
|
| @@ 1315-1332 (lines=18) @@ | ||
| 1312 | * |
|
| 1313 | * @since 2.1 |
|
| 1314 | */ |
|
| 1315 | function pods_field_display ( $pod, $id = false, $name = null, $single = false ) { |
|
| 1316 | // allow for pods_field_display( 'field_name' ); |
|
| 1317 | if ( null === $name ) { |
|
| 1318 | $name = $pod; |
|
| 1319 | $single = (boolean) $id; |
|
| 1320 | ||
| 1321 | $pod = get_post_type(); |
|
| 1322 | $id = get_the_ID(); |
|
| 1323 | } |
|
| 1324 | ||
| 1325 | $pod = pods( $pod, $id ); |
|
| 1326 | ||
| 1327 | if ( is_object( $pod ) ) { |
|
| 1328 | return $pod->display( $name, $single ); |
|
| 1329 | } |
|
| 1330 | ||
| 1331 | return null; |
|
| 1332 | } |
|
| 1333 | ||
| 1334 | /** |
|
| 1335 | * Get a field raw value from a Pod |
|