Support

Account

Home Forums ACF PRO Repeater field problem

Solved

Repeater field problem

  • Acfs, estou com uma dúvida abaixo segue o meu código. Atualmente estou com campo repetidor, para atores com imagem e o link da taxonomy.
    Acfs, I have a question below below to follow my code. I currently have repeater field, for actors with image and taxonomy link.
    The first is the first and last name, the second is the name of the character, the third field is the image and the fourth field is the taxonomy, the problem that when registering only appears the term link of the first field registered, the others are with the same name. Could someone indicate the error?

     <?php $rows = get_field('actor');
                     if($rows){
                    echo '<ol class="people scroller">';
                        foreach($rows as $row){
                           echo '<li class="card"><a href=' . $term_link . '><img width="138px" height="175px"  class=" profile fade lazyautosizes lazyloaded" src=' . $row['image-profile'] . ' alt=' . $row['primeiro_nome'] . '> </a><a href=' . $term_link . '>'. $row['primeiro_nome'] . ' ' . $row['ultimo_nome'] . '</a>
    <p class="character"> ' . $row['personagem_atual'] . '
    </li>';
                          }
                        echo '</ol>';
    
                        }
    
          ?>

    .

    Sorry my english is bad =/

  • If I understand it correctly, only the link in the first item is correct ?

    By the looks of it, the first instance in the loop gets the value from $term_link. Every item after it copies the link from the first instance, since it’s not ‘overridden’.

    I don’t know how your repeater is setup, but instead of $term_link I expect you would either use something like $row[‘term_link’] since it’s part of the repeater.

  • The term_link I placed to automatically pull the taxonomy. As the name of the taxonomy is an actor, I realized that it could pull without I having the need to create a field and include it there. Because every time I create a field the names of the first field is duplicated with the others.

  • This is my repeater field. When I choose multiple selections or just single selection. Every time saved the name actor charlie cox doubles in the backend. When I place the taxonomy inside row.

    http://res.cloudinary.com/meugamer/image/upload/v1519491030/taxonomy-actor_qeluxe.jpg

  • If I put only the $ term_link, it recognizes the taxonomy and shows the path of the taxonomy, but if I put it in row it shows the url of the post and not the taxonomy.

  • I am sorry…. but I (still) don’t understand your problem.

  • My problem is when I choose the name of the actors in the front end, only the link of the first actor appears for all. If I put $ term-link to taxonomy it appears: mysite / personal / name-actor. Now if I put row [] it only appears mysite / name-post. However, when I choose the first option. All fields in the image above the url is only for charlie-cox.

    Even selecting all the actors with the correct term. Just the mysite / personal / charlie-cox url. It appears in all fields on the front end rather than appears only in the field that I selected. I hope I have been able to explain correctly now. =).

  • My problem is when I choose the name of the actors in the front end, only the link of the first actor appears for all. If I put $ term-link to taxonomy it appears: mysite / personal / name-actor. Now if I put row [] it only appears mysite / name-post. However, when I choose the first option. All fields in the image above the url is only for charlie-cox.

    Even selecting all the actors with the correct term. Just the mysite / personal / charlie-cox url. It appears in all fields on the front end rather than appears only in the field that I selected. I hope I have been able to explain correctly now. =)…

  • I understand that the link of the first actor appears for all. That sounds to me like the link/value is set outside the foreach and doesn’t get changed anymore.

    If I understand the problem correctly, your links are not generated correctly.

    I don’t see anything in your code that defines $term_link. This needs to be ‘defined’ for each single row so where you have $term_link, I think it should have something like get_term_link( $term_id|object ).

  • I tried putting it in row to draw a conclusion. Simply the content filled it out, and all the content below in the first image. However, in the second image, I left without filling the taxonomy, of course nothing will appear, but the content with the images of the gallery appears normally. Is it some taxonomy bug? I’m just finding problem with this code, above. You sent me the term_id | object should I create a while for this?

     <?php $rows = get_field('actor');
                     if($rows){
                    echo '<ol class="people scroller">';
                        foreach($rows as $row){
                           echo '<li class="card"><a href='. $row['term_link'] .'><img width="138px" height="175px"  class=" profile fade lazyautosizes lazyloaded" src=' . $row['image-profile'] . ' alt=' . $row['primeiro_nome'] . '> </a><p><a href='. $row['term_link'] .'>'. $row['primeiro_nome'] . ' ' . $row['ultimo_nome'] . '</a></p><p class="character"> ' . $row['personagem_atual'] . '</p></li>';
                          }
                        echo '</ol>';
    
                        }
    
          ?>

  • I want to help you but your English is not optimal so it’s hard to understand at some points.

    If you have a field for taxonomy, it returns should return either an object or a taxonomy id. So if you echo $row[‘term_link’] it will not be a link, but an object or an ID.

    So instead of $row[‘term_link’] it should be get_permalink($row[‘term’]) (to create a link out of the returned value).

    “I left without filling the taxonomy, of course nothing will appear, but the content with the images of the gallery appears normally.”

    If you leave out the taxonomy selector, the rest should still show since they’re not depending on each other (as far as I can see in your code).

    I think it would be a lot easier if I could look at (all) your code. If you’re online, contact me through my website, maybe I can help you out. Might go faster than this.

  • Hello, I saw your message in the other forum. I had already done as you reported. But it does not work all over the site I only have problems in that part. I’m thinking of creating another term instead of short codes to call properly. Because every time I use the field to call taxonomy the site disappears in half.

  • As I mentioned on SO, I made an error in the code above. It should not be get_permalink, but get_term_link.

    According to your code $term_link is set outside of the example and after that not changed anymore, so it makes sense it stays the same.

    If the site disappears, you made an error somewhere. It’s better to find the error than to redo everything.

  • Hello, sorry I typed wrong. The site is showing up and the urls are running. I’m just watching, when I’m registering the fields within the post. When saved the post is repeating the same taxonomy. I’ll test if it’s any backend conflict. The good that urls now seem to work. =). Thank you very much. You were very collaborative. This is a personal project in the imdb style. Soon I’m creating many custom files. It’s a project that I’ve already been developing for almost five months.

  • I deleted the old taxonomy and re-created a new one and it looks like it’s working. I’ll go testing it slowly =).

  • Glad to hear. Can you mark the topic here (and on SO 🙂 ) as resolved then ?

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

The topic ‘Repeater field problem’ is closed to new replies.