Using ACF in WP Admin as opposed to the builder / Customize page template

Hi. I need to add some ACFs to my pages (WP Admin > Pages), as opposed to using shortcodes within the builder. What I’d like to do next is create some JS arrays from these ACFs, so my question is - how to modify the page template PRO uses very slightly, so as to run a check for the AFC repeater field, and then convert the fields to php array and then encode to JS.

I can do all the tricky stuff, I just need to know how to run the the AFC repeater code on the correct page template. I tried putting it in functions.php in the hope that it would pick it up but it obviously doesn’t. (Normally I would just run the AFC repeater on whatever page template I need to generate content.)

Hope this makes sense!

Hello @doughballs,

Thanks for writing in! There are two ways to display the ACF field. By using the ACF shortcode or the get_field() function. Please check out this documentation instead:

Hope this helps.

Hi @RueNel

Sorry, I think you misunderstood. I know how to display the fields. What I want to know is WHERE to put the repeater loop. The first link you sent shows how to display the AFC in wp-single. I would like to display on a standard page - not a blog psot. So which template do I need to modify?

Hey @doughballs,

There are lots of page template available in our theme so I’m not sure what I’ll point you to since we don’t have the URL of the page where you want to add the repeater field. Please give us the URL of the page.

If there’s no URL, please check these page templates in the screenshot.

Hope that helps.

Hey. Ok so there are multiple URLs, the vast majority of the site. These are the classnames added to the body:

page-template page-template-template-blank-4 page-template-template-blank-4-php page page-id-143 logged-in x-renew x-full-width-layout-active x-full-width-active x-post-meta-disabled x-child-theme-active pro-v2_5_5 cornerstone-v3_5_4

So maybe page.php?

How would I amend that template - which is built with the builder - without messing it up? The new content I’ll be adding will actually be hidden - I’m just outputting rh ACF data there to use via JS!

In the past you have helped me to alter the layout of single.php to style blog posts - but blog posts are not built with the page builder, so it was safe to do so! Is it possible to add to this page template without compromising what PRO does via the builder?

Hello @doughballs,

If you want to add a repeater field for a page, I would recommend that you added it in content-page.php file. To do that, assuming that you have your child theme active and ready, please follow these steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file


// =============================================================================
// -----------------------------------------------------------------------------
// Standard page output for Renew.
// =============================================================================


<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <div class="entry-wrap">
    <?php if ( has_post_thumbnail() ) : ?>
      <div class="entry-featured mtn">
        <?php x_featured_image(); ?>
    <?php endif; ?>
    <?php if ( ! is_singular() ) : ?>
    <header class="entry-header">
      <h2 class="entry-title">
        <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
    <?php endif; ?>
    <?php x_get_view( 'global', '_content' ); ?>

Do not forget to add your modifications like the repeater field.

3] Save the file named as content-page.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/pro-child/framework/views/renew/

You will need to create the folder path since it does not exist yet in your child theme.

Please let us know how it goes.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.