frontend/web/blog_mysql/wp-content/themes/v20190812/inc/template-tags.php
/**
 * Prints the attached image with a link to the next attached image.
 */
Prints the attached image with a link to the next attached image.
Prints the attached image with a link to the next attached image .
function sirat_the_attached_image() {
	$post                = get_post();
	$attachment_size     = apply_filters( 'sirat_attachment_size', array( 1200, 1200 ) );
	$next_attachment_url = wp_get_attachment_url();
	$attachment_ids 	 = get_posts( array(
		'post_parent'    => $post->post_parent,
		'fields'         => 'ids',
		'numberposts'    =>  1,
		'post_status'    => 'inherit',
		'post_type'      => 'attachment',
		'post_mime_type' => 'image',
		'order'          => 'ASC',
		'orderby'        => 'menu_order ID'
	) );
	if ( count( $attachment_ids ) > 1 ) {
		foreach ( $attachment_ids as $attachment_id ) {
			if ( $attachment_id == $post->ID ) {
				$next_id = current( $attachment_ids );
				break;
			}
		}
		if ( $next_id )
			$next_attachment_url = get_attachment_link( $next_id );
		else
			$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
	}
	printf( '<a href="%1$s" rel="attachment">%2$s</a>',
		esc_url( $next_attachment_url ),
		wp_get_attachment_image( $post->ID, $attachment_size )
	);
}
function sirat_the_attached_image ( ) { $ post = get_post ( ) ; $ attachment_size = apply_filters ( 'sirat_attachment_size' , array ( 1200 , 1200 ) ) ; $ next_attachment_url = wp_get_attachment_url ( ) ; $ attachment_ids = get_posts ( array ( 'post_parent' => $ post -> post_parent , 'fields' => 'ids' , 'numberposts' => 1 , 'post_status' => 'inherit' , 'post_type' => 'attachment' , 'post_mime_type' => 'image' , 'order' => 'ASC' , 'orderby' => 'menu_order ID' ) ) ; if ( count ( $ attachment_ids ) > 1 ) { foreach ( $ attachment_ids as $ attachment_id ) { if ( $ attachment_id == $ post -> ID ) { $ next_id = current ( $ attachment_ids ) ; break ; } } if ( $ next_id ) $ next_attachment_url = get_attachment_link ( $ next_id ) ; else $ next_attachment_url = get_attachment_link ( array_shift ( $ attachment_ids ) ) ; } printf ( '<a href="%1$s" rel="attachment">%2$s</a>' , esc_url ( $ next_attachment_url ) , wp_get_attachment_image ( $ post -> ID , $ attachment_size ) ) ; }
Prints the attached image with a link to the next attached image.
Prints the attached image with a link to the next attached image .
// If there is more than 1 attachment in a gallery... // get the URL of the next image attachment... // or get the URL of the first image attachment.