Home › Forums › Front-end Issues › Group fields not showing on front end
Hello friends
I am trying to show a group of fields but somehow its not showing on front end although my other group fields shows on front end
here is my coode
<section id="about" class="about">
<?php $video = get_field('video_section'); ?>
<div class="container">
<div class="row">
<div class="col-xl-5 col-lg-6 video-box d-flex justify-content-center align-items-stretch">
<a href="<?php echo $video['video_link']; ?>" class="venobox play-btn mb-4" data-vbtype="video" data-autoplay="true"></a>
</div><!--col-xl-5-->
<div class="col-xl-7 col-lg-6 icon-boxes d-flex flex-column align-items-stretch justify-content-center py-5 px-lg-5">
<h3><?php echo $video['video_header']; ?></h3>
<p><?php echo $video['video_subheader']; ?></p>
me using WordPress 5.3.3 and acf pro Version 5.8.7
any help will be appreciated,thanks
www\wordpress\wp-content\themes\Mediqas\front-page.php:62:null
see this
i re added the group few times but see same result
but i use two other groups on same page
and they show fine
and this is one of the other groups
var_dump($hero)
shows the array
array (size=4)
'main_title' => string 'WELCOME TO MEDIQAS' (length=18)
'small_title' => string 'Devoted to medicine excellence for 10 years' (length=43)
'link_text' => string 'GET STARTED' (length=11)
'link' => string 'http://localhost/wordpress/why-us/' (length=34)
It’s strange. I would try creating a new field group and checking. You should also pay attention to the field name. Try to replace it, there are conflicts with plugins.
You can also check the database. Is there data for this group of fields.
Hi
before you say that i just tried creating a new field group
with new sub field names
$video2 = get_field(‘video2’);
and its var_dump also retuns null
www\wordpress\wp-content\themes\Mediqas\front-page.php:65:null
i feel lost :\
i have no other fields in database with tht name
hi
I just checked the wp databse
and run this query
SELECT * FROM wp_postmeta WHERE meta_key LIKE '%video%'
and you can see the video field does have data
see screenshot
Hi!
I have tested this on my project. Everything works. I will write as I did so that you can compare.
1. Created a field Group of fields for the required post type (in my case for posts)
2. Edited the post, filled in the data in the subfields
3. In the template for the post added the code
<? php $video = get_field('video_section');
var_dump($video); ?>
4. Go to the post page and see this
array(3) { ["video_link"]=> string(18) "https://my-link.com" ["video_header"]=> string(5) "Title" ["video_subheader"]=> string(8) "Subtitle" }
What are you doing differently?
Wrote an answer, but it disappeared. I’ll write again.
I have checked on my project. Everything works. I will write how I do, compare with how you do.
1. Create a group of fields (in my case for posts)
2. Create a post. I fill in the created fields.
3. open the page template for the post. I add the code
$video = get_field('video_section');
var_dump($video);
4. I open the post and see this
array(3) { ["video_link"]=> string(18) "https://my-link.com" ["video_header"]=> string(5) "Title" ["video_subheader"]=> string(8) "Subtitle" }
What are you doing differently?
I don’t have a great solution here but just wanted to add that I think I’m experiencing the same problem. Last week, a subfield of a Group field wouldn’t display on the frontend (either in the browser or when debugging variables). I was able to get it to show by installing a version of ACF that was a point version below the current, then upgrading again to the current version. It’s super hacky and not something I’m hoping to have to do again, and not something I want to replicate on the live site for my current project.
I’m now experiencing a similar issue (maybe same?) with a Flexible Content field. Old layouts and subfields work just fine. But the new subfields of a new layout won’t display in the template or when debugging.
I’m beginning to wonder if there’s an issue with the plugin in cases where subfields are necessary (Group fields, Repeater fields, Flexible Content fields, etc.)
@sash_007, I’ve downgraded my ACF Pro plugin to 5.7.9 and am able to reliably var_dump new subfields added to existing groups, which I wasn’t able to do before. I’m still having issues with my Flexible Content field, but maybe this is useful for your issue.
@sash_007, another update. I was able to resolve the issue by using the “Generate PHP” feature in the “Tools” panel and adding that generated PHP to my theme. If your version of the plugin has that generate feature, it might be worth trying it out.
I just checked wp_postmeta it has some 5000 rows generated mostly because of acf as i was using the same wp installation to try acf on seveal wp themes so i decided to try a fresh wp install and setup the theme there..hope that will work..thanks
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!
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.