You appear to be a bot. Output may be restricted
Description
Theme a field of type 'noderef'If it's a multiple link then display the results as an unordered list, otherwise display a single item. For a multiple link we have to avoid 'None' which has a value of 0, and is not a valid post ID.
Usage
bw_theme_field_noderef( $key, $value, $field );
Parameters
- $key
- ( string ) required – the field name
- $value
- ( mixed ) required – the ID of the post either directly or as $value[0] or an array of posts
- $field
- ( array ) required – the information about the field
Returns
voidTO DO
Also support comma separated display format.Source
File name: oik-fields/includes/oik-fields.incLines:
1 to 31 of 31
function bw_theme_field_noderef( $key, $value, $field ) { bw_trace2(); $started = false; //bw_backtrace(); $multiple = bw_array_get( $field['#args'], "#multiple", false ); if ( $multiple ) { if ( is_array( $value ) && count( $value ) ) { foreach ( $value as $key => $v0 ) { if ( $v0 ) { if ( !$started ) { sul(); $started = true; } stag( "li" ); $title = get_the_title( $v0 ); alink( null, get_permalink( $v0 ), $title ); etag( "li"); } } if ( $started ) { eul(); } } } else { $v0 = bw_array_get( $value, 0, $value ); if ( $v0 ) { $title = get_the_title( $v0 ); alink( null, get_permalink( $v0 ), $title ); } } }View on GitHub