- This topic is empty.
-
AuthorPosts
-
November 19, 2012 at 9:30 pm #114821
zeech
MemberHey @chrisburton I think I figured it out! Thanks!
November 19, 2012 at 10:39 pm #114828chrisburton
Participant@zeech You sure?
November 20, 2012 at 12:24 am #114835zeech
Member@chrisburton – I believe so – I figured out how to attach and show the image in the correct DIV on the template. I can style the image with CSS.
Here is my markup in my template:$attachments = attachments_get_attachments();
$total_attachments = count($attachments);
?>
0 ) : ?>$tmp_attachment_id = $attachments[$i];
$tmp_post_id = get_post($tmp_attachment_id);
$tmp_title = $tmp_post_id->post_title;
$tmp_path_array = explode(“/”,$attachments[$i]);
$tmp_array_length = sizeof($tmp_path_array)-1;
$tmp_filename = $tmp_path_array[$tmp_array_length];
$j=$i+1;
?>echo wp_get_attachment_image($attachments[$i], $size=’full’, $icon = true);
?>Here is the basic CSS for the image:
.attachments-div {
position: relative;
float: right;
width: 35%;
}.attachments-div img {
border:#000 solid 1px;
float:left;
}And now using this template I can allow the client to upload and attach an image to the right hand column.
My PHP is limited, so not totally sure what all the code means on the PHP side, but it worked! Do you see any thing wrong with it?
Thanks again @chrisburtonzack
November 20, 2012 at 4:08 am #114848chrisburton
ParticipantDepending on the dimensions for `$size=’full’`, you might want to replace ‘full’ with ‘thumbnail’. If they are already sized correctly that code should work.
November 20, 2012 at 11:12 am #114925zeech
MemberYeah I saw that in the code, actually changed it to full from thumbnail – one quick question, is there a PHP call that I can add for a hyperlink? Say I want to use the images and have them link to a specific page? An example (excuse the funky CSS background color) is this page: using attachments to build the thumbs, but would like them to link to the proper case studies page: http://weir-tsus.com/attachments/
If you have quick answer thanks! If not I have hassled you enough! Thanks again @chrisburton
cheers
zackNovember 20, 2012 at 1:48 pm #114941chrisburton
Participant@zeech This is what I use:
$attachments = attachments_get_attachments();
$total_attachments = count( $attachments ); if( $total_attachments ) : ?>
“>
November 25, 2012 at 12:58 am #115375zeech
Member@chrisburton thank your for the code!
I did a slight modification to this chunk:
“>November 25, 2012 at 1:02 am #115376zeech
MemberSorry not letting me post the code properly… Trying again:
chrisburton
Participant@zeech I don’t think that’s correct. I believe it should be:
“>
AuthorPosts- The forum ‘Back End’ is closed to new topics and replies.