You appear to be a bot. Output may be restricted
Description
Format the data in a tableThe titles are returned by the post type… what if it's not a custom post type The fields are returned by the post type… ditto If oik-fields (v1.18 or higher) is not loaded then we need to load the functions to "theme" fields. See bw_format_table_row() If the version loaded still doesn't have bw_theme_field() then we can't continue.
Usage
bw_format_table( $posts, $atts );
Parameters
- $posts
- ( array ) required – array of post objects
- $atts
- ( array ) required – shortcode parameters
Returns
voidSource
File name: oik/shortcodes/oik-table.phpLines:
1 to 40 of 40
function bw_format_table( $posts, $atts ) { $atts['post_type'] = $posts[0]->post_type; $post_type = $posts[0]->post_type; $excerpts = bw_query_table_columns( $atts, $post_type ); if ( !function_exists( "bw_theme_field" ) ) { oik_require_lib( "bw_fields" ); if ( !function_exists( "bw_theme_field" ) ) { bw_trace2( "bw_theme_field missing" ); BW_::p( __( "Error: bw_theme_field function missing.", "oik" ) ); return; } } $totals = bw_array_get( $atts, 'totals', null ); $csv_totals = null; if ( $totals ) { oik_require_lib( 'class-oik-csv-totals' ); $csv_totals = new Oik_csv_totals( $totals ); } $cp = bw_current_post_id(); foreach ( $posts as $post ) { bw_current_post_id( $post->ID ); if ( $excerpts ) $post->excerpt = bw_excerpt( $post ); if ( $totals ) { $csv_totals->rows(); } bw_format_table_row( $post, $atts, $csv_totals ); } if ( $csv_totals ) { $prefixes = bw_array_get( $atts, 'prefixes', null ); $csv_totals->totals_row( $prefixes ); } bw_current_post_id( $cp ); etag( "tbody" ); etag( "table" ); }View on GitHub View on Trac