Description
Determine what we should be listing based on the current post
Usage
bw_query_related_fields( $atts );Parameters
- $atts
- ( array ) required – array of shortcode parameters post_type meta_key action ——— ——– ———————————————– set set n/a – this function should not have been called set null find tbc null set tbc null null tbc
Returns
voidTO DO
tbcSource
File name: oik-fields/shortcodes/oik-related.phpLines:
1 to 19 of 19
function bw_query_related_fields( &$atts) { $post_type = bw_array_get( $atts, "post_type", null ); if ( $post_type ) { // The meta_key is not set - we need to find a meta_key value for a noderef field from the specified post type to the current post type $meta_key = bw_query_field( bw_global_post_type(), $post_type ); } else { $meta_key = bw_array_get( $atts, "meta_key", null ); if ( $meta_key ) { $post_type = bw_query_post_type( bw_global_post_type(), $meta_key ); } else { // Neither set list( $post_type, $meta_key ) = bw_query_post_type_and_meta_key( $atts ); //$meta_key = ?; } } $atts['post_type'] = $post_type; $atts['meta_key'] = $meta_key; return( $meta_key ); }View on GitHub
Invoked by
Calls
1 to 4 of 4
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_query_field() – Query the field name for a noderef pointing to this post type
- bw_query_post_type() – Query the source post type which has a noderef field $meta_key referencing the current_post_type
- bw_query_post_type_and_meta_key() – Query post type and meta key for performing a bw_related
