get_posts fixes from DD32 and filosofo. see #6772
git-svn-id: https://develop.svn.wordpress.org/trunk@7892 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b0ff8876f0
commit
468ac2a54e
@ -349,7 +349,8 @@ function gallery_shortcode($attr) {
|
||||
}
|
||||
|
||||
extract(shortcode_atts(array(
|
||||
'orderby' => 'menu_order ASC, ID ASC',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ID',
|
||||
'id' => $post->ID,
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
@ -359,7 +360,7 @@ function gallery_shortcode($attr) {
|
||||
), $attr));
|
||||
|
||||
$id = intval($id);
|
||||
$attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}");
|
||||
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
||||
|
||||
if ( empty($attachments) )
|
||||
return '';
|
||||
@ -433,7 +434,7 @@ function next_image_link() {
|
||||
function adjacent_image_link($prev = true) {
|
||||
global $post;
|
||||
$post = get_post($post);
|
||||
$attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC"));
|
||||
$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
|
||||
|
||||
foreach ( $attachments as $k => $attachment )
|
||||
if ( $attachment->ID == $post->ID )
|
||||
|
@ -408,10 +408,12 @@ function get_posts($args = null) {
|
||||
'order' => 'DESC', 'include' => '',
|
||||
'exclude' => '', 'meta_key' => '',
|
||||
'meta_value' =>'', 'post_type' => 'post',
|
||||
'post_status' => 'publish', 'post_parent' => 0
|
||||
'post_parent' => 0
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
if ( empty( $r['post_status'] ) )
|
||||
$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
|
||||
if ( ! empty($r['numberposts']) )
|
||||
$r['posts_per_page'] = $r['numberposts'];
|
||||
if ( ! empty($r['category']) )
|
||||
|
Loading…
Reference in New Issue
Block a user