• Im having problems with the following code:

    ?php
    $args = array(
    	'order'          => 'ASC',
    	'post_type'      => 'attachment',
    	'post_parent'    => $post->ID,
    	'post_mime_type' => 'image',
    	'rel'            => 'shadowbox',
    	'post_status'    => null,
    	'numberposts'    => -1,
    );
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		echo wp_get_attachment_link($attachment->ID, 'medium');
    	}
    }
    ?>

    I need to figure out a way to add the value rel=shadowbox to these images that are being outputted by this code. Any help would be greatyly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter hatefulcrawdad

    (@hatefulcrawdad)

    oops, the code is actually this… I forgot to take out my attempt at adding rel to it.

    ?php
    $args = array(
    	'order'          => 'ASC',
    	'post_type'      => 'attachment',
    	'post_parent'    => $post->ID,
    	'post_mime_type' => 'image',
    	'post_status'    => null,
    	'numberposts'    => -1,
    );
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		echo wp_get_attachment_link($attachment->ID, 'medium');
    	}
    }
    ?>
    Thread Starter hatefulcrawdad

    (@hatefulcrawdad)

    The more I look at it and fool around, the more it gets screwy. Shouldn’t there be a way to either push the rel though in the $args array? Or to echo the a tag and rel, then use the get attachment url? When I try that, it seems to break. Any help will be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems with image attach tag’ is closed to new replies.