Home › Forums › Add-ons › Repeater Field › Repeater sub_fields: not view attachments and postObject sub_field in front-end
Hi support!
I’ve a problem.
I’ve created a website (using Jupiter Theme) and the articles are been migrated by other database.
In many articles there are attachments or postObject sub_fields (created by Repeater add-on).
Those subfields are already filled by the migrate of the database, so when I’ve viewed an article (back-end side) the attachments or postObject are setted.
When I viewed the article (front-end side) the attachment or postObject can’t view.
But if I go back in back-end side of the article and I upload a attachment file or add a postObject, In font-end side of article I see the custom field uploaded.
I’ve many categories and for each of they I’ve different ‘custom fields’ and ‘sub fields’.
That’s the code that I’ve used:
for custom field text :
<?php if( get_field(‘evento_primopiano’) ): ?>
Primo piano: <?php the_field(‘evento_primopiano’); ?>
<?php endif; ?>
For attachment in repeater sub field:
<?php
// check if the repeater field has rows of data
if( have_rows(‘evento_allegati’) ):
// loop through the rows of data
while ( have_rows(‘evento_allegati’) ) : the_row();
// display a sub field value
//the_sub_field(‘evento_allegato_file’);
?>Allegati: “target=’_blank’ “><?php echo get_sub_field(‘evento_allegato_titolo’); ?>
<?php
endwhile;
else :
// no rows found
endif;
?>
And for postObject in repeater sub fields:
<?php
$attivita_eventi = get_field(‘evento_rassegnestampa’);
if ($attivita_eventi): ?>
<?php
while(has_sub_field(‘evento_rassegnestampa’)): ?>
<?php
$p = get_sub_field(‘evento_rassegnastampa’);
?>
Rassega stampa correlata : “><?php echo $p->post_title; ?>
<?php endwhile; ?>
<?php endif; ?>
Thank you so much for your support.
Best regards.
What version of ACF are you using? How did you move that ACF field groups from the old site to the new site?
Hi! thank you for answer.
I’m using ACF 4.4.5 and the add-on Repeater CF 1.1.1 version.
I have a old site structured by many fields with text, dates or relation post.
Now I’ve migrated this informations in custom field.
The text fields are viewed but the attachment and the postObkect no.
Thank you so much
The reason that some fields are not showing up on the new site is most likely because the field keys for those fields are different on the new site but the key stored in the database is still the key from the old site. When this happens ACF does not know what to do with the data in those fields.
The simplest but probably the most time consuming way to fix this would be to open and save every page on your site. This would cause ACF to save the correct field key.
You could attempt to export the ACF posts using the standard WP export and import them to your new site, but if you’ve changed the groups then you’ll have a problem with any new data that you’ve entered.
You can go into MySQL and to a search & replace to replace all the new field key values with the old field key values in the postmeta table.
Make sure you back up your database if you try either of the last 2.
You must be logged in to reply to this topic.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.