Apologies for the delayed response. Basically, when I add the above-mentioned code I get the 500 error. I tried with removing the hooks as well but the same result.
THE ACF fields show up in the backend.
Just to give you some context, I am trying to add the repeater field on a page like this https://faded-print.flywheelsites.com/platform/.
I am assuming that this page is a PAGE and the backend file is page.php
Could you please confirm that the very 1st step is to create ACF fields in the plugin area and then proceed to add the code?
Cheers
Ally
Hello,
I added the following code in page.php file but adding anything in that file breaks all my pages.
// Remove Skip Links
remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
// Dequeue Skip Links Script
add_action( 'wp_enqueue_scripts', 'genesis_sample_dequeue_skip_links' );
function genesis_sample_dequeue_skip_links() {
wp_dequeue_script( 'skip-links' );
}
// Force full width content layout
// Remove site header elements
// remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
// remove_action( 'genesis_header', 'genesis_do_header' );
// remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
// Remove navigation
// remove_theme_support( 'genesis-menus' );
// Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
// Remove footer widgets
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
// Remove site footer elements
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
// Remove page title
// Remove site inner wrap
add_filter( 'genesis_structural_wrap-site-inner', '__return_empty_string' );
// Remove edit link
add_filter ( 'genesis_edit_post_link' , '__return_false' );
// Load landing page styles
add_action( 'wp_enqueue_scripts', 'landing_do_tables_styles' );
function landing_do_tables_styles() {
wp_enqueue_style( 'tables', CHILD_URL . '/tables.css', array(), PARENT_THEME_VERSION );
}
//======================================================================
// BEGIN ACF CONTENT
//======================================================================
add_action( ‘genesis_entry_content’, ‘ACF_content’ );
function ACF_content() {
if( have_rows('content-block') ): ?>
<div class="any-class-name">
<?php // loop through rows (parent repeater)
while( have_rows('content-block') ): the_row(); ?>
<div style="background-color:<?php get_sub_field('background_color'); ?>">
<p><?php get_sub_field('content'); ?></p>
</div>
endwhile;
else :
// no rows found
endif;
</div>
?>
<?php }
//======================================================================
// END ACF CONTENT
//======================================================================
I really appreciate your time and effort but unfortunately, I wasn’t able to make it work. Are there any changes that needs to be added in functions.php file because we have another website which uses ACF and the code is added in functions file.
Regards,
Ali
Hi Rociopts,
Thank you for taking out time and responding back. Unfortunately, it didn’t work. Here is what I did:
1) Copy single.php file from parent theme (genesis to child theme (business pro)
2) Copied the 1st code excerpt you provided and pasted it before “genesis();” in the single.php file which now exists in child theme.
3)Then I copied the 2nd part of code and pasted it in the same file.
4) I replaced the content between strong tags with the acf code that I have posted in my 1st comment which starts like this *** Predefined Custom Fields ***/
Just to give you a complete picture here is some further info
– Business pro is my child theme while genesis is parent theme.
– I am just trying to add an acf repeater field which includes a color picker and an editor for description.
– These repeater fields are required on all PAGES. By pages I mean the PAGES that you see on the left sidebar of wordpress dashboard. These are different from POSTS which are blogs etc.
Once again highly appreciate your effort.
Regards,
Ali
Hi R,
I am trying to add this as a template in all my posts which are pages.
Ally
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.