Home › Forums › ACF PRO › have_rows() Issue › Reply To: have_rows() Issue
@hube2 – Thanks, but no go. have_rows() still returns FALSE in the second function.
// Check for alternative title
add_filter( 'genesis_post_title_text', 'bk_process_title' );
function bk_process_title($title) {
if(have_rows('flex_content')) {
while(have_rows('flex_content')) {
the_row();
if(get_row_layout() == 'sales') {
$acf_field = get_sub_field('title');
return $acf_field ? $acf_field : $title;
}
}
reset_rows();
} else {
return $title;
}
}
// Check for alternative listing content
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'bk_process_content', 11 );
function bk_process_content() {
if(have_rows('flex_content')) {
while(have_rows('flex_content')) {
the_row();
if(get_row_layout() == 'sales') {
$acf_field = get_sub_field('deck');
if($acf_field) {
echo $acf_field;
}
}
}
reset_rows();
} else {
the_excerpt();
}
}
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.