Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1038362

    Hello,
    with ACF i created a repeater field. Since i don´t want this field to be shown on every site in my backend i need a method to target specific sites or a group of sites.
    So i choose to make a new template – called “news” – and told ACF only to be shown when the “news” template is choosen.
    I put the code for my output into my function.php file. (not the best way but i don`t know it better).
    All works fine, exept i don´t see the output from my repeater field in the frontend.
    When i switch back to the “template-builder” template – all works.

    So i think i made a mistake while duplicating the template:
    I copied the existing “template-builder”, renamed it to “template-news” and added /* Template Name: News */ on top of it – then i put the file into my child theme…

    Can you please help me, or point me in the right direction?
    Best regards, chris

    #1040110

    Hey Chris,

    Thank you for using Enfold.

    If you’re not using the ALB then you should render the the ACF fields in the page.php file. If ALB is active, edit the template-builder.php file. Unfortunately, you can’t create a clone of the template-builder.php file or rename it.

    Best regards,
    Ismael

    #1041357

    Hey Ismael,
    Thank you for your tip. I duplicated the page.php file and renamed it – its working fine. Didn´t know that you can´t duplicate the template-builder.php file.

    You said i should render the ACF fields in the page.php file.
    Can you give me a hint where i have to put my ACF Code in the page.php file so that it renders after the content? Right now i have my code in the function.php file:

    add_action('ava_after_content', 'add_content_after_content');
    function add_content_after_content() {
    ?><div style="margin-top: 20px;"><?php	
    	if( have_rows('nslides') ):
    	while( have_rows('nslides') ): the_row();
    
    		  ?><div class='newsclass1 shadow'>
    				<div class='newsclass2'>
    					<img src='/fix/news/newslogo1.png' style="float:left"/>
    					<img src='/fix/news/newslogo2.png' style="float:right"/>
    					<div class='newsclass3'><?php the_sub_field('ntitel1'); ?></br><?php the_sub_field('ntitel2'); ?></div>
    				</div>
    				<div class='newsclass31'><img src='<?php the_sub_field('nbild'); ?>' class='newsclass4' /></div>
    				<div class='newsclass31'><div class='newsclass5'><?php the_sub_field('ntext'); ?></div></div>
    			</div>
    <?php endwhile;
    	endif;?>
    </div><?php
    }

    best regards
    – chris

    #1041598

    Hi,

    page.php file so that it renders after the content?

    Edit the includes > loop-page.php file and look for this code:

      echo '
    <div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>';
                        the_content(__('Read more','avia_framework').'<span class="more-link-arrow"></span>');
                    echo '</div>
    ';
    

    Insert the render function below.

    Best regards,
    Ismael

    #1043280

    Thank you, its working fine.

    #1043600

    Hi,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1043601

    Sorry, yes please close it.

    #1043667

    Hi,

    Thanks for letting us know, I’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘ACF repeater field not showing’ is closed to new replies.