[Plugin: Attachments] cleaner code indexing
-
Hi all,
finally found a gallery plugin that outputs exactly what I want.
%INDEX%<img src=”%THUMBNAILPATH%” alt=”%IMAGETITLE%” title=”%IMAGEDESCRIPTION%” />
The exact code I used in a page template is:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php $attachments = attachments_get_attachments(); ?> <?php $attachments = attachments_get_attachments(); $total_attachments = count($attachments); ?> <?php if( $total_attachments > 0 ) : ?> <?php for ($i=0; $i < $total_attachments; $i++) : ?> <a href="javascript:void(0)"><?=$attachments[$i]['id']?><img src="<?=$attachments[$i]['location']?>" alt="<?=$attachments[$i]['title']?>" title="<?=$attachments[$i]['caption']?>" /></a> <?php endfor ?> <?php endif ?> </div> <?php endwhile; endif; ?>
Problem 1: The output has a lot of line breaks and gives no clean code
Here’s the output:<a href="javascript:void(0)"> 925 <img src="https://www.trouwshoot.nl/wp-content/uploads/Myk-en-Tamara-3340.jpg" alt="foto 1" title="captions 1" /></a> <a href="javascript:void(0)"> 924 <img src="https://www.trouwshoot.nl/wp-content/uploads/Bruiloft-Denis-en-Patricia-38611.jpg" alt="foto 2" title="captions 2" /></a> <a href="javascript:void(0)"> 923 <img src="https://www.trouwshoot.nl/wp-content/uploads/Bianca_Melvin-2973.jpg" alt="foto 3 " title="caption 3" /></a> </div>
My second problem is that the ID’s have a large number. For me the best thing would be if all pictures could be indexed. So instead of ID=923 you will get INDEX=1
The 3rd problem is that I can add as much images I want, but after 20 images my screen gets full and I need a >>> link to a next page with images 21 till 40. So paging all links would be great.
I do’nt think that’s build in so I think I need to program that myself, but since I am a photographer and no programmer I have no idea how to do.
What I’ve got for now you can see over here: https://www.trouwshoot.nl/test-gallery/
What I want to accomplish is this: https://www.trouwshoot.nl/foto-gallerij/
This gallery get pictures from Picasa and gives me some problems with the providers firewall, so that’s why I need to have the pictures locally.Hope that anybody can help me out since the original programmer of the Attachments plugin doesn’t respond at all.
Stefan
- The topic ‘[Plugin: Attachments] cleaner code indexing’ is closed to new replies.