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