| @@ 1344-1361 (lines=18) @@ | ||
| 1341 | * |
|
| 1342 | * @since 2.1 |
|
| 1343 | */ |
|
| 1344 | function pods_field ( $pod, $id = false, $name = null, $single = false ) { |
|
| 1345 | // allow for pods_field( 'field_name' ); |
|
| 1346 | if ( null === $name ) { |
|
| 1347 | $name = $pod; |
|
| 1348 | $single = (boolean) $id; |
|
| 1349 | ||
| 1350 | $pod = get_post_type(); |
|
| 1351 | $id = get_the_ID(); |
|
| 1352 | } |
|
| 1353 | ||
| 1354 | $pod = pods( $pod, $id ); |
|
| 1355 | ||
| 1356 | if ( is_object( $pod ) ) { |
|
| 1357 | return $pod->field( $name, $single ); |
|
| 1358 | } |
|
| 1359 | ||
| 1360 | return null; |
|
| 1361 | } |
|
| 1362 | ||
| 1363 | /** |
|
| 1364 | * Get a field display value from a Pod |
|
| @@ 1375-1392 (lines=18) @@ | ||
| 1372 | * |
|
| 1373 | * @since 2.1 |
|
| 1374 | */ |
|
| 1375 | function pods_field_display ( $pod, $id = false, $name = null, $single = false ) { |
|
| 1376 | // allow for pods_field_display( 'field_name' ); |
|
| 1377 | if ( null === $name ) { |
|
| 1378 | $name = $pod; |
|
| 1379 | $single = (boolean) $id; |
|
| 1380 | ||
| 1381 | $pod = get_post_type(); |
|
| 1382 | $id = get_the_ID(); |
|
| 1383 | } |
|
| 1384 | ||
| 1385 | $pod = pods( $pod, $id ); |
|
| 1386 | ||
| 1387 | if ( is_object( $pod ) ) { |
|
| 1388 | return $pod->display( $name, $single ); |
|
| 1389 | } |
|
| 1390 | ||
| 1391 | return null; |
|
| 1392 | } |
|
| 1393 | ||
| 1394 | /** |
|
| 1395 | * Get a field raw value from a Pod |
|