'Contents',
'div_class' => 'contents pagemenu list_pages',
'ul_class' => 'contents pagemenu list_pages',
'ol_class' => FALSE,
'excerpt' => FALSE,
'icon' => FALSE,
'echo' => 0,
'show_parent' => FALSE,
'child_of' => $id,
'depth' => 1,
'sort_column' => 'menu_order, post_title',
'title_li' => '',
'show_date' => '',
'date_format' => get_option('date_format'),
'exclude' => '',
'authors' => '',
), $arg );
$prefix = $suffix = '';
if( $arg['div_class'] ){
$prefix .= '
';
$suffix .= '
';
if( $arg['title'] )
$prefix .= ''. esc_html( $arg['title'] ) .'
';
if( $arg['ul_class'] ){
$prefix .= ''. $suffix;
}else if( $arg['ol_class'] ){
$prefix .= '';
$suffix = '
'. $suffix;
}
}else{
if( $arg['title'] )
$prefix .= ''. $arg['title'] .'
';
if( $arg['ul_class'] ){
$prefix .= ''. $suffix;
}else if( $arg['ol_class'] ){
$prefix .= '';
$suffix = '
'. $suffix;
}
}
if(( $arg['excerpt'] ) || ( $arg['icon'] )){
$this->list_pages->show_excerpt = $arg['excerpt'];
$this->list_pages->show_icon = $arg['icon'];
return( $prefix . ( $arg['show_parent'] ? ''. get_the_title( $arg['child_of'] ) .'' : '' ) . preg_replace_callback( '//i', array( &$this, 'list_pages_callback'), wp_list_pages( $arg )) . $suffix );
}
return( $prefix . ( $arg['show_parent'] ? ''. get_the_title( $arg['child_of'] ) .'' : '' ) . wp_list_pages( $arg ) . $suffix );
}
function list_pages_callback( $arg )
{
global $id, $post , $bsuite;
if( $this->list_pages->show_excerpt ){
$post_orig = unserialize( serialize( $post )); // how else to prevent passing object by reference?
$id_orig = $id;
$post = get_post( $arg[1] );
$id = $post->ID;
$content = ( $this->list_pages->show_icon ? ''. $bsuite->icon_get_h( $arg[1] , 's' ) .'' : '' ) . apply_filters( 'the_content', get_post_field( 'post_excerpt', $arg[1] ));
$post = $post_orig;
$id = $id_orig;
if( 5 < strlen( $content ))
return( $arg[0] .'' );
return( $arg[0] );
}else{
$content = apply_filters( 'the_content', get_post_field( 'post_excerpt', $arg[1] ));
return( $arg[0] .'' );
}
}
function list_attachments($attr)
{
global $post;
/*
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ( $output != '' )
return $output;
*/
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( !$attr['orderby'] )
unset( $attr['orderby'] );
}
extract( shortcode_atts( array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'post_mime_type' => FALSE ,
/*
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'thumbnail'
'post_mime_type' => 'image',
*/
), $attr ));
$id = absint($id);
$attachments = get_children( array(
'post_parent' => $id ,
'post_status' => 'inherit' ,
'post_type' => 'attachment' ,
'order' => $order,
'orderby' => $orderby,
));
if ( empty( $attachments ))
return '';
$output = "\n";
foreach ( $attachments as $att_id => $attachment )
$output .= ''. wp_get_attachment_link( $att_id, FALSE, FALSE ) . "\n";
return '';
}
}
$bsuite_list_children = new bSuite_List_Children;