Home › Forums › Add-ons › Repeater Field › The Word Array Displays
I have a client that has a repeating list of communities. I wrote a script to add a counting id number to each community to create an anchor link for the page. The script works but also displays the word “ARRAY”. I have been racking my brain on how to fix this. Any thoughts?
<?php if( have_rows('communities') ): ?>
<hr>
<?php
$i = 1;
while(have_rows('communities')): echo '<div id="community-' . $i . '">' . the_row() . the_sub_field('community_name'); '</div>';
$i++;
?>
<?php the_sub_field('community_slideshow'); ?>
<?php the_sub_field('community_description'); ?>
<hr>
<a href="#top">Back to top</a>
<hr>
<?php endwhile; ?>
<?php endif; ?>
Hi @fultonman
Is it possible that one of your two subfields is returning an array and not a string?
Could you debug the output from your repeater rows using var_dump() function?
Hi, any updates on what made the solution? Having the same problem with, Array, is written in front of the link.
Hi, any updates on what made the solution? Having the same problem with, Array, is written in front of the link.
add_filter( ‘woocommerce_product_tabs’, ‘woo_new_tab’ );
function woo_new_tab( $tabs ) {
// Hide empty tabs
if ( ! empty( $tabs ) ) {
foreach ( $tabs as $title => $tab ) {
if ( empty( $tab[‘content’] ) && strtolower( $tab[‘title’] ) !== ‘description’ ) {
unset( $tabs[ $title ] );
}
}
}
$tabs[‘new2’] = array(
‘title’ => __( ‘Monteringsvejledninger’, ‘woocommerce’ ),
‘priority’ => 40,
‘callback’ => ‘woo_new_tab_content2’
);
return $tabs;
}
function woo_new_tab_content2() {
// The new tab content
echo $link = get_field(‘monteringsvejledninger’);
if( $link ):
$link_url = $link[‘url’];
$link_title = $link[‘title’];
$link_target = $link[‘target’] ? $link[‘target’] : ‘_self’;
?>
” target=”<?php echo esc_attr( $link_target ); ?>”><?php echo esc_html( $link_title ); ?>
<?php endif;
}
The topic ‘The Word Array Displays’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.