You appear to be a bot. Output may be restricted
Description
Return the field value for the given fieldrefLookup the noderef then access the field value for that noderef Assumptions:
- The fields are single fields
- the noderef is a noderef field for the current post
- the field_name is a value field in the target_post
Usage
$string = bw_query_fieldref_value( $fieldref, $post_id );
Parameters
- $fieldref
- ( string ) required – in format _node_ref._field_ref
- $post_id
- ( ID ) optional – post ID, if not the global post
Returns
string the value or nullSource
File name: oik-fields/shortcodes/oik-related.phpLines:
1 to 10 of 10
function bw_query_fieldref_value( $fieldref, $post_id=null ) { list( $noderef_name, $field_name ) = explode( ".", $fieldref ); $target_post = bw_query_field_value( $noderef_name, $post_id ); if ( $target_post ) { $value = bw_query_field_value( $field_name, $target_post ); } else { $value = null; } return( $value ); }View on GitHub