Support » Themes and Templates » Setting attachment size dynamically

Setting attachment size dynamically

  • Hi folks,

    With the function 'wp get attachment image' you can set the size to use, however, I am wanting the size to be set by whatever the user picks for the image in the media uploader. Is this possible? Currently we have to set ‘medium’, ‘full’ etc, but surely it would work if we could set whatever the user selects.

    Currently my code looks like this:

    <ul class="project-individual-image-container">
    $args = array(
    	'post_type' => 'attachment',
    	'post_status' => null,
    	'post_parent' => $post->ID,
    	'exclude'     => get_post_thumbnail_id(),
    	'order'       => ASC,
    	'orderby'	  => menu_order,
    	'post_mime_type' => 'image',
    	'numberposts'	=> -1,
    $attachment_page = get_attachment_link( $attachment_id );
    $attachments = get_posts($args);
    	if ($attachments) {
    		foreach ($attachments as $attachment) {
    			echo '<li>'.wp_get_attachment_image($attachment->ID, '').'</li>';


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Setting attachment size dynamically’ is closed to new replies.