• I want to use Advanced Custom Fields in my onepage site. Here’s my code in index.php to list all pages:

    <?php
                        $args = array(
                            'sort_order' => 'ASC',
                            'sort_column' => 'menu_order', //post_title
                            'hierarchical' => 1,
                            'exclude' => '',
                            'child_of' => 0,
                            'parent' => -1,
                            'exclude_tree' => '',
                            'number' => '',
                            'offset' => 0,
                            'post_type' => 'page',
                            'post_status' => 'publish'
                        );
                        $pages = get_pages($args);
                        //start loop
                        $count = 0;
                        foreach ($pages as $page_data) {
                        $count++;
                            $content = apply_filters('the_content', $page_data->post_content);
                            $title = $page_data->post_title;
                            $slug = $page_data->post_name;
                            $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'bg' );
                        ?>

    I want to create some variable called $subtitle and get my ACF-Field ‘subtitle’. How can I achieve this?

  • The topic ‘ACF in onepage site’ is closed to new replies.