Support

Account

Forum Replies Created

  • I solved this but maybe this might help someone! I was making it WAY harder then it was!

    Here is what I did to get a class called ‘multiple’ or wrapper around my repeater:

    <?php  //begin some repeating fields for if multiple trips to same country */
    
                elseif (get_row_layout() == 'trip_card') :  ?>
    
    <?php if (have_rows('multiple_trips')) :
                        echo '<div class="multiple">'; //begin wrapper
    
                        // loop through the rows of data
                        while (have_rows('multiple_trips')) : the_row(); ?>
    
    <?php
                            //vars
                            $first_trip_title = get_sub_field('first_trip_title');
                            $first_trip_date = get_sub_field('first_trip_date');
                            //$counter = 2;
    
                            //display a sub field value 
                            ?>
    <div><strong><?php echo $first_trip_title; ?>:</strong>
    
        <?php echo $first_trip_date; ?></div>
    
    <?php endwhile;
                        echo '</div>' ?>
    <!-- end of wrapper:  multiple -->
    <?php else : ?>
    <?php // no rows found 
                        ?>
    <?php endif; ?>
  • SORRY this code looks better ~ same as above but w/ variables for easier reading; but still not what I’m looking for, AND I should have mentioned (not that this matters but this Repeater field is inside of a Layout)

    This might be easier to read:

    <?php  //begin some repeating fields for if multiple trips to same country */
                elseif (get_row_layout() == 'trip_card') : ?>
    
    <?php if (have_rows('multiple_trips')) :
                        // loop through the rows of data
                        while (have_rows('multiple_trips')) : the_row();
    
                            //vars
                            $first_trip_title = get_sub_field('first_trip_title');
                            $first_trip_date = get_sub_field('first_trip_date');
    
                            //display a sub field value 
                    ?>
    <div id="multiple">
        <p><strong><?php echo $first_trip_title; ?>:</strong>
    
            <?php echo $first_trip_date; ?></p>
    </div><!-- end of multiple -->
  • OK thank you I actually got it to work like this… but is this proper usage? It seems to work well with using the get_field_object ?? Like this:

    <div id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
    
    <?php
    
    $bullet_color = get_field_object('bullet_color');
    if($bullet_color=="lite-color") {
    	echo $lite-color;
    }elseif ($bullet_color=="dark-color") {
    	echo $dark-color;
    }
    
    ?>
    
    	<?php if ( have_rows( 'list_item' ) ) : ?>
    		<ul class="<?php the_field('center');?>">
    		
    		<?php while ( have_rows( 'list_item' ) ) : the_row(); 
    		
    		// var
    		$selection = get_sub_field('bullet_style');
    	if($selection=="asterisk") {
    		echo $ion-asterisk;
    	}elseif ($selection=="checkmark")   {
    		echo $ion-checkmark;
    	}
    	?>
    	
    	<li class="<?php echo $selection?> <?php the_field('bullet_color'); ?>">
    	
    	<?php the_sub_field( 'add_item' ); ?> </li>
    			
    			
    		<?php endwhile; ?>
    		
    	<?php else : ?>
    		
    		<?php // no rows found ?>
    		
    	<?php endif; ?>
    	</ul>
    	</div>

    It seems that if I switch to the underscore it doesn’t echo out the class properly which actually is .ion-asterisk? I think it’s odd because the class does have a dash in it…

  • I’m sorry I accidentally got that posted twice! I will check the other post; thank you!

  • I finally fixed this and just had some stuff in the wrong order. Working code:

    add_action( 'genesis_entry_content', 'bbb_gallery_fields' );
    
    function bbb_gallery_fields() {
    
       if ( have_rows( 'add_an_album' ) ) : ?>
       
       <?php while ( have_rows( 'add_an_album' ) ) : the_row(); ?>
       <div class="album-card">
            <div class="slide slide-top">
            <div class="slide-content"><a class="slide-link" href="<?php the_sub_field( 'link_to_album' ); ?>">View Album</a> </div>
                
            <?php $album_thumbnail = get_sub_field( 'album_thumbnail' ); ?>
    		
    			<?php echo wp_get_attachment_image( $album_thumbnail, 'one-fourth' ); ?>
                </div>
               
                <h2><?php the_sub_field( 'album_title' ); ?></h2>
                </div>          
                                   
            <?php endwhile; ?>
        <?php else : ?>
            <?php // no rows found ?>
        <?php endif; 
    
    }
  • I forgot to add this: here is what it looks like now when the first one on the left is hovered with mouse; the image is like only somehow only half as tall as it should be and the link text is missing and the Heading tag with the name of the trip is somehow being pushed behind it..

    See: When first one on the left is on hover

  • Is there a way take this a step further and still have the responsive images srcset to the image size choosen? I think you have to incorporate this code somehow to what I have :

    I saw this other post and wondered if I add the "wp-image-{$image_id}" in if that would solve it.

    Thank you!!

  • YAY! Thank you so much that worked!! THANK YOU!

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