Support

Account

Forum Replies Created

  • This works perfectly – thankyou for taking the time to help out.

  • Thanks for the swift reply John. The code example you posted work so long as there are exact multiples of 4 ‘Repeater Field Content’ blocks. Is it possible to modify the code so that the div elelments close where there are not 4, 8 or 12 and so on – so if (for example) there were only 5 blocks of ‘Repeater Field Content’ the divs are closed in the approriate place (as below)

    <div><!–- outer container for 4 figure elements -–>
      <div><!–- inner container for 2 of the 4 figure elements -–>
        <figure>Repeater Field Content</figure>
        <figure>Repeater Field Content</figure>
      </div>
      <div><!–- inner container for 2 of the 4 figure elements -–>
        <figure>Repeater Field Content</figure>
        <figure>Repeater Field Content</figure>
      </div>
    </div>
    
    <div><!–- outer container for maximum of 4 figure elements -–>
      <div><!–- inner container for up to 2 of the 4 figure elements -–>
        <figure>Repeater Field Content</figure>
      </div>
    </div>
  • The code John posted for AvWijk is pretty much what I am looking for however I need insert a further break within the rows. So the output would be…

    <div>// outer container for 4 figure elements
       <div>//inner container for 2 of the 4 figure elements
         <figure>Repeater Field Content</figure>
         <figure>Repeater Field Content</figure>
       </div>
       <div>//inner container for 2 of the 4 figure elements
         <figure>Repeater Field Content</figure>
         <figure>Repeater Field Content</figure>
       </div>
    </div>
    
    <div>// outer container for 4 figure elements
       <div>//inner container for 2 of the 4 figure elements
         <figure>Repeater Field Content</figure>
         <figure>Repeater Field Content</figure>
       </div>
       <div>//inner container for 2 of the 4 figure elements
         <figure>Repeater Field Content</figure>
         <figure>Repeater Field Content</figure>
       </div>
    </div>

    Many thanks in advance to any help offered!

  • I have used wp_get_attachment_image_src to display my images – I’m doing it this way as I need to use the image’s caption (post_excerpt) as my ‘alt’ content. Frustratingly (for me with limited experience!) timstl code works only when using wp_get_attachment_image. With this in mind how would I change timstl’s snippet so it works form me also? Here’s what I’m working with…

    <?php if(get_field('post_images')): ?>
    		<?php while(the_repeater_field('post_images')): ?>
    			<?php 	$image = wp_get_attachment_image_src(get_sub_field('post_image'), 'large');
    					$largeImage = wp_get_attachment_image_src(get_sub_field('post_image'), 'full');
    					$attachment_id = get_post_thumbnail_id($post_id); ?>
                <li <?php  the_sub_field('module_class');?>>
                <a href="<?php echo $largeImage[0]; ?>" title="<?php $attachment = get_post($attachment_id); echo($attachment->post_excerpt); ?>">
    	    	<img src="<?php echo $image[0]; ?>" alt="<?php $attachment = get_post($attachment_id); echo($attachment->post_excerpt); ?>" /></a></li>
    	    <?php endwhile; ?>
    	</ul>
    		<?php endif; ?>
  • Thanks for your help Elliot. All sorted now.

    <?php
    // INCLUDE ONLY THE MOST IMPORTANT PHOTO TAGS IN THE LIST.
    // 51 - Architecture
    // 52 - Scapes
    // 29 - UK
    // 43 - Interiors
    // 36 - Personal
    // 38 - Commercial
    // 30 - People
    // 'orderby' => 'name',		// sort by name or count (Alphabetical) or count (Most used)
    // 'order' => 'ASC',		// in ASCending or DESCending order
    $types[0] = 'media-tags'; 
    foreach ($types as $type) { 
     $terms = get_terms($type, array('name_like' => "a", 'order' => 'DESC', 'orderby' => 'count', 'include' => '51,52,29,43,36,38,30') ); 
     if ($terms) { 
      foreach($terms as $term)  { 
    	$image = wp_get_attachment_image_src(get_field('term_thumbnail', 'media-tags_'.$term->term_id.''), 'thumbnail');
    	$genreDescription = get_field('genre_description', 'media-tags_'.$term->term_id.'');
    	$moduleClass = get_field('moduleclass', 'media-tags_'.$term->term_id.'');
    
    	echo '
    	<li class="'.$moduleClass.'  block project">
    		<a href="/archive/photographs/'.$term->slug.'">';
       echo '<img src="'.$image[0].'"/>
       <div>
    								<div>
    									<h2>'.$term->name.'</h2>
    									'.$genreDescription.'
    								</div>
    							</div>
    							</a>
    						</li>';
    						}
    					}
    				}
    				?>
  • Thanks Elliot.

    I’ve moved the $moduleclass = get_field('moduleclass') code inside the loop but am obviously doing something wrong as it’s still not working. Could you give an example of code that you’d expect to work please?

  • Moduleclass is a field that has been assigned to ‘Taxononmy’ = ‘media-tags’ using the location rules. The field then appears on the ‘Edit Media Tag’ page (the term). So, “yes, it’s field on each term”.

Viewing 7 posts - 1 through 7 (of 7 total)