Support

Account

Home Forums General Issues Why is control by metabox, when i need control by ACF ?

Solving

Why is control by metabox, when i need control by ACF ?

  • Hi , all

    I have issue on my page, I am on posts and every post control metabox, but i need ACF inside blocks for control, whats a problem pls ?

    Problem is i cannot change photo or text….from ACF…everything control metaboxes ?

    This is loop:

    <?php
    /**
     * Sekce novinky 2 blog
     *
    **/
    
     
    
    $id = 'novinky2-' . $block['id'];
    if( !empty($block['anchor']) ) {
        $id = $block['anchor'];
    }
    
    // Create class attribute allowing for custom "className" and "align" values.
    $className = 'novinky2';
    if( !empty($block['className']) ) {
        $className .= ' ' . $block['className'];
    }
    if( !empty($block['align']) ) {
        $className .= ' align' . $block['align'];
    }
    
     $nadpisdark = get_field('nadpis_novinek') ?: '';
    ?>
    
     <section id="<?php echo esc_attr($id); ?>" class="novinky-detail <?php echo esc_attr($className); ?>">   
    
     
     
     <div class="container">
     <div class="row">
      <div class="col-12">
      
     <h2 class="h2dark"><?php echo $nadpisdark; ?></h2>
     
     </div>
      </div>
      </div>
       <div class="container">
      <div class="row"> 
      
                   <?php 
                      
    $pocetprispevku = get_field('pocet_prispevku_novinek') ?: '2';                  
                      
                      
    $args = array(
      'posts_per_page' => $pocetprispevku,
    	'post_type'		=> 'post',
      'orderby' => 'publish_date',
    	'order'				=> 'DESC'
    );
    
    // query
    $the_query = new WP_Query( $args );
    
    ?>
    <?php if( $the_query->have_posts() ): ?>
    
    	<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
       <?php
       
       global $post;
       
       ?>
    
    	 <div class="col-12 col-sm-12 col-md-6 col-lg-12 col-xl-6">
    			<a class="product-card-clanky" href="<?php the_permalink(); ?>">
          
              
            <div class="hero-left"> 
            <div class="product-card__image">
    				<div class="img-container">
        
                       <?php 
             $obrazek = get_field('obrazek_pro_vypis', get_the_ID());
             
             
               
             ?>
           
    				<img src="<?php echo $obrazek['url']; ?>" alt="<?php echo the_title(); ?>" title="<?php echo $obrazek['title'];  ?>" />
            
            </div>
            
            </div>
            </div>
            
            
              <div class="hero-content">
            <div class="product-card__head">
    				<h2 class="h2dark-xs"><?php the_title(); ?></h2>
            </div>
            
            
              
     
       
            
          
          <div class="product-card__body mb-3">
          
          <?php $excerpt = wp_trim_words( get_field('novinky_text',  get_the_ID()) , $num_words = 14, $more = '...' ); ?>
    				<p class="popisek-sekce"><?php echo $excerpt; ?></p>
            
            
            
        </div> 
      <div class="product-card-info mt-2 mb-2">      
          <span class="read-more" href="<?php the_permalink(); ?>"> Číst více </span>
      </div>  
            </div> 
    			</a>
          
        
          
          
    		</div>	
    	<?php endwhile; ?>
    
    <?php endif; ?>
    
    <?php wp_reset_query();	 // Restore global post data stomped by the_post(). ?>
    
    </div>
    
       </div>
     
    
      
    
    
  • When i do not use block, and target acf fields to posts….then its working normally….

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

The topic ‘Why is control by metabox, when i need control by ACF ?’ is closed to new replies.