Jump to content

marting

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by marting

  1. Hi Digibucc, I have been experimenting with it for hours and haven't gotten anywhere unfortunately. If you could help me with the if statement that would be fantastic! Thanks,
  2. Hi Digibucc, This code is getting there but is not quite there as you can see. It is still displaying double the amount of images, but now the images are in the right order and the links are kind of close, so the purpley coloured shoes should link to the shoes taxonomy/group. Any ideas? I feel like there is something up with the foreach statements, I think that is what is creating double the amount of images. What other word can be used instead of foreach so it kind of joins or allows for the 2 statements simultaneously? Thanks,
  3. Hi Digibucc, I have implemented that code, as you can see with that code, which I think is identical to my original code, it shows both images twice, but the links kind of work. Do you know how we can get it to just show 1 image for each. Thanks!
  4. Hi Digibucc, This is the code so far. You will notice I removed the [0] from the $recent_project_thumb as that was causing the images to not display properly as well. <ul id="gallery-list"> <?php foreach($latest_projects as $post) : setup_postdata($post); $recent_project_thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-work'); $categories = get_terms('gallery_cats'); var_dump($recent_project_thumb); var_dump($categories); ?> <li><a href="https://ivyvintage.com/gallery-category/<?php echo $categories->slug; ?>" title="<?php the_title(); ?>"><img src="<?php echo $recent_project_thumb[0]; ?>" alt="<?php the_title(); ?>" width="162" height="100" class="imgstyle" /></a></li> <?php endforeach; ?> </ul> This is what is actually looks like on the web: https://ivyvintage.com/ Under the 'Latest Photos' section. As you can see it is outputting all this nasty stuff in the HTML and I think it is because the: <?php echo $cat->slug; ?> is missing. I am sorry for not showing you this at the start as it probably would have helped. Thanks,
  5. Hi Digibucc, The code you provided is nearly working. What isn't working is the link part of it. I think what is throwing it out is you took out the: foreach ($categories as $cat ) How would I incorporate that in what you provided here: <?php foreach($latest_projects as $post) : setup_postdata($post); $recent_project_thumb[0] = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-work'); $categories = get_terms('gallery_cats'); var_dump($recent_project_thumb[0]); var_dump($categories); ?> Thank you for being so helpful!
  6. Hi Digibucc, I don't want 2 loops, I want one loop, so it displays the image just once and its link. How would I combine these loops? I must apologise I am a real newbie at PHP, so if you could provide a sample it would greatly help me understand. Thank you,
  7. I should mention that the original code also was displaying double the amount of images. but the links were working ok.
  8. Hi digibucc, Thanks for your help. When I do that it it doubles the amount of images than what is supposed to show and it doesn't display the image anymore it just shoes the title. Do you know what might be going on? Here's a sample of the code now: <ul id="portfolio-list"> <?php foreach($latest_projects as $post) : setup_postdata($post); $recent_project_thumb[0] = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-work'); ?> <?php $categories = get_terms('gallery_cats'); foreach ($categories as $cat ) : ?> <li><a href="https://website.com/gallery-category/<?php echo $cat->slug; ?>" title="<?php the_title(); ?>"><img src="<?php echo $recent_project_thumb[0]; ?>" alt="<?php the_title(); ?>" width="162" height="100" class="imgstyle" /></a></li> <?php endforeach; ?> <?php endforeach; ?> </ul> Thanks,
  9. I am having an issue with a gallery I am building. It's a Wordpress website, and the gallery has an image for each item and when clicking on the image it links to the posts taxonomy. I can get either the images to display correctly or the links to work, but I can't get both to work together (I think it's the start and end I am screwing up). Here's the code: <ul id="portfolio-list"> <?php foreach($latest_projects as $post) : setup_postdata($post); $recent_project_thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-work'); ?> <?php $categories = get_terms('gallery_cats'); foreach ($categories as $cat ) : ?> <li><a href="https://website.com/gallery-category/<?php echo $cat->slug; ?>" title="<?php the_title(); ?>"><img src="<?php echo $recent_project_thumb[0]; ?>" alt="<?php the_title(); ?>" width="162" height="100" class="imgstyle" /></a></li> <?php endforeach; ?> <?php endforeach; ?> </ul> Thank you for your assistance I really appreciate it!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.