Description
Get the post / custom post type identified by the ID and post typeNote: If we know the ID then why not just call get_post()? ? 2012/11/03 Changed from is_int() to is_numeric() but not yet done above 2012/12/03
Usage
$post = bw_get_post( $post_id, $post_type, $atts );Parameters
- $post_id
- ( integer ) required – the ID of the post to retrieve
- $post_type
- ( string ) required – the post type of the post ( could be "any" )
- $atts
- ( array ) optional – shortcode parameters
Returns
post a single postSource
File name: oik/includes/bw_posts.phpLines:
1 to 21 of 21
function bw_get_post( $post_id, $post_type, $atts=null ) { if ( null == $atts ) { $atts = array(); } if ( is_numeric( $post_id ) ) { $atts['include'] = $post_id; } else { $atts['name'] = $post_id; } $atts['numberposts'] = 1; $atts['post_type'] = $post_type; $posts = get_posts( $atts ); if ( $posts ) { $post = bw_array_get( $posts, 0, null ); } else { // gobang() or doingitwrong or something $post = null; } bw_trace2( $post, "post", true, BW_TRACE_INFO ); return( $post ); }View on GitHub View on Trac
Called by
Invoked by
Calls
1 to 2 of 2
