Hope this function helps:
my_ezg_subfolders_links();
or
my_ezg_subfolders_links( $postID, ‘hash’, ‘data-any:”thing”‘ )
/* my_ezg_subfolders_links()
*
* post_id - parent post id
* type - hash OR no-hash
* data - include additional attributes string
*
*/
function my_ezg_get_subfolders_links( $post_id = 0, $type = 'no-hash', $data = '' ) {
$output = '';
list( $orderby, $order ) = explode( '-', eazyest_gallery()->sort_by() );
$children = get_children( array(
'numberposts' => -1,
'post_parent' => $post_id,
'post_type' => eazyest_gallery()->post_type,
'order' => $order,
'orderby' => $orderby,
'post_status' => array( 'publish', 'inherit' )
));
foreach ( $children as $post ) {
$output .= "<li><a href=". ( $type == 'hash' ? $post->guid : "#{$post->post_name}");
$output .= " data-id= $post->ID ";
if ( $type == 'hash' )
$output .= " data-href= $post->guid ";
if ( $data )
$output .= " {$data}";
$output .= ">{$post->post_title}</a></li>";
}
return $output;
}
function my_ezg_subfolders_links( $post_id = 0, $type = 'no-hash', $data = '' ) {
echo my_ezg_get_subfolders_links( $post_id, $type , $data );
return;
}