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?
Thanks. I was able to get it to work.
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;
}