Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $post;
- $post_id = get_post_custom($post->ID);
- $slide_bg_array = get_post_meta($post->ID, "custom_meta_slide_bgimg", false);
- global $wpdb;
- if ( !is_array( $slide_bg_array ) )
- $slide_bg_array = ( array ) $slide_bg_array ;
- if ( !empty( $slide_bg_array ) ) {
- $slide_bg_array = implode( ',', $slide_bg_array );
- $images = $wpdb->get_col( "
- SELECT ID FROM $wpdb->posts
- WHERE post_type = 'attachment'
- AND ID IN ( $slide_bg_array )
- ORDER BY menu_order ASC
- " );
- $image = reset($images);
- } else {
- $image = "";
- }
- $imgsrc = wp_get_attachment_image_src( $image, 'full' );
- $imgsrc = $imgsrc[0];
- $slide_bgimg = "url(". $imgsrc .")";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement