Support

Account

Home Forums General Issues ACF usage with Genesis Framework Reply To: ACF usage with Genesis Framework

  • Oh ok I misunderstood, your initial response “in all my posts which are pages”. So for pages:

    1. Delete the single.php page, let’s start fresh again! 🙂
    2. move the page.php file to your child theme
    3. Add the following before “genesis()”, edit based on your theme style.
    // 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
    //======================================================================

    Now you need to add the Genesis hook to display your content so add the following code.

    ‘add_action( ‘genesis_entry_content’, ‘anyname_here’ );
    function anyname_here() {

    Here add your your acf code. Example below

    <?php }
    //======================================================================
    // END ACF CONTENT
    //======================================================================’

    It sounds like you are also not sure how to use the ACF code for a repeater field. I will give you and example code that you can then edit using the correct field name and html. I also recommend this page with more details https://www.advancedcustomfields.com/resources/repeater/

    Here is an example code you could easily change to your settings, you would add this to the code above.

    if( have_rows('your_repeater_field_name') ): ?>
    <div class="any-class-name">
    						
    <?php // loop through rows (parent repeater)
    while( have_rows('your_repeater_field_name') ): the_row(); ?>
    
    <div style="background-color:<?php get_sub_field('your_color_field_name'); ?>">
    <p><?php get_sub_field('your_description_field_name'); ?></p>
    </div>
    endwhile;
    
    else :
        // no rows found
    endif;
    </div>
    ?>

    I haven’t tested the above code, but this has a repeater field, color picker and textarea. You need to change the code field names (anything with “your_field_name” change) to match what you created in acf. Look at the documents for each field if you run into an issue. With this you should be able to get it working. If still not working then send a screenshot of your acf fields and send the code you are using. Good Luck!