• Resolved roothost

    (@roothost)


    Hi,

    Any ideas how to replicate this as a template? It’s the code inside the <small></small> tag that isn’t playing ball?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @roothost,
    I think something went wrong with your post… I’m not seeing the example template.

    Don’t forget to wrap code in a code block in this editor.

    Cheers,

    • This reply was modified 7 years, 8 months ago by Darren Cooney.
    Thread Starter roothost

    (@roothost)

    Let’s try again, it’s the code inside the <small> tag that isn’t working via the template.

    <li>
              <?php if( get_field('hide_single_page') ) { ?>
              <?php the_post_thumbnail(); ?>
              <?php } else { ?>
              <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
              <?php } ?>  
              <div></div>  
              <span><?php the_title(); ?><br />
              <?php foreach( $posts as $post ): 
    
            setup_postdata( $post )
    
            ?>
              <small><?php
    $args = [
        'orderby' => 'parent', 
        'order'   => 'DESC' 
    ];
    $terms  = wp_get_object_terms( $post->ID, 'band', $args );
    $names  = wp_list_pluck( $terms, 'name' );
    $output = implode( ', ', $names );
    echo $output; ?></small>
              <?php endforeach; ?>
              </span>
              <?php if( get_field('hide_single_page') ) { ?>
              <?php } else { ?>
              </a>
              <?php } ?>  
            </li>
    Thread Starter roothost

    (@roothost)

    Nobody able to help?

    Plugin Author Darren Cooney

    (@dcooney)

    Hi.

    Code looks ok but try adding global $post; at the start of your repeater template.

    Issue might be $post is undefined.

    • This reply was modified 7 years, 8 months ago by Darren Cooney.
    Plugin Author Darren Cooney

    (@dcooney)

    Closing. Will re-open if you still require assistance.

    Hi, Sorry, all sorted now.

    Thank you ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help with template’ is closed to new replies.