Support

Account

Home Forums Front-end Issues Group field not showing afte creating custom post type

Solved

Group field not showing afte creating custom post type

  • Hello friends

    I am wondering why group fields not showing after creating custom post type?
    Although it shows if i remove the custom post type

    here is my code

    before removing wp custom post type

    iv class="col-lg-8 d-flex align-items-stretch">
    		     <div class="icon-boxes d-flex flex-column justify-content-center">
    			      <div class="row">
    				     <?php
    					 $args =  array(
    						 'post_type' => 'emergency',
    						 'posts_per_page' => 3
    						);
    						$emergency = new WP_Query($args);
    						
    						while($emergency->have_posts()){
    							$emergency->the_post();
    		               ?>
    					  <div class="col-xl-4 d-flex align-items-stretch">
    
    						<div class="icon-box mt-4  mt-xl-0">
    						   <i class="<?php the_field('emergency_icon'); ?>"></i>
    							<h4><?php the_title(); ?></h4>
    							<p><?php echo wp_trim_words(get_the_excerpt(),15);?></p>
    						</div><!--icon-box-->
    					 </div><!--col-xl-4-->
    						<?php } ?>
    		        </div><!--row-->
    			 </div><!--icon-boxes-->
    		  </div><!--col-lg-8-->
    	   </div><!--row-->
    	 </div><!--container-->
       </section><!--why-us-->
       
       <!--About-section-->
       <section id="about" class="about">
         <?php $video = get_field('video_section'); 
    	 $video2 = get_field('video2'); 
    	var_dump($video);
    	  //var_dump($video2);
    	 ?>
         <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>

    and after removing emegency custom post type

    var_dump($video); returns this

    array (size=3)
      'video_header' => string 'Personal Care For your Healthy Living' (length=37)
      'video_subheader' => string 'We care fo your health, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis aute irure dolor in reprehenderit Asperiores dolores sed et. Tenetur quia eos. Autem tempore quibusdam vel .' (length=233)
      'video_link' => string 'https://www.youtube.com/watch?v=Fv7TOFpGdHM' (length=43)

    What am i doing wrong? i do want to use wp custom post type not repeater
    you can draw reference from my other threadhttps://support.advancedcustomfields.com/forums/topic/group-fields-not-showing-on-front-end/
    but setting up theme on new wordpress didnt work
    any help will be appeciated,thanks

  • ok i got this solved
    i added wp_reset_postdata() after emergency custom post type

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.