Forum Replies Created

  • Thanks!!!!!

    That’s it. I have to learn a lot much more….

    One more thing… Can I automatically cut the lenght of one of the subfields?, say I want the “resumen” subfield to be 250 characters long and then a “Read More” link that goes to the “enlace” subfield. Can I do that?

    Thanks again James, today you are my hero!

  • Thanks James! The thing is that it is a flexible content or repeater (both can do the work) and I don’t know how many elements will be there so I need to add a counter and some sort of “magic” so it knows when an element is the first one of each row.

    Now I have:

    if( have_rows('tribuna') ):
    	while( have_rows('tribuna') ): the_row(); 
    		// vars
    		$image = get_sub_field('imagen');
    		$content = get_sub_field('resumen');
    		$link = get_sub_field('enlace');
    		$title = get_sub_field('titulo');
    		if( get_row_layout() == 'articulo_tribuna'):?>
    				<div class="medio-tribuna one-fourth first">
    				<?php if( $link ): ?>
    					<a href="<?php echo $link; ?>">
    				<?php endif; ?>
    					<img src="<?php echo $image; ?>" />
    				<?php if( $link ): ?>
    				<?php endif; ?>
    				    <h2><?php echo $title; ?></h2>
    				    <?php echo $content;?></div> 
    		else: //no layouts found

    It is working but every element is first element… I need class”first” to be added only to first of each row (of 4)

    Does it make any sense?

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