Support

Account

Home Forums Front-end Issues LightBox images in custom content field 2

Solved

LightBox images in custom content field 2

  • hi
    thank you for this suggestion,

    http://support.advancedcustomfields.com/forums/topic/lightbox-images-in-custom-content-field/

    <?php 
    
    $wysiwyg = get_field('field_name', false, false);
    
    echo apply_filters('the_content', $wysiwyg);
    
     ?>

    to run lightbox with acf wysiwyg-field,

    but it doesn´t work for me. My Code is

    <div class="entry-content">
        		<?php the_content(); ?>
    		<?php
    			wp_link_pages( array(
    				'before' => '<div class="page-links">' . __( 'Pages:', 'pictorico' ),
    				'after'  => '</div>',
    			) );
    		?>
            <?php if(get_field('spalten')): ?>
              <?php while(has_sub_field('spalten')): ?>
              <div class="columns">
              <div class="col-left"><?php 
    		  $wysiwyg = the_sub_field('linke_spalte', false, false); 
    		  echo apply_filters('the_content', $wysiwyg);
    		  ?></div>
              <div class="col-right"><?php 
    		  $wysiwyg = the_sub_field('rechte_spalte', false, false); 
    		  echo apply_filters('the_content', $wysiwyg);
    		  ?></div>
              </div>
              <?php endwhile; ?>
              <?php endif; ?>
    	</div><!-- .entry-content -->

    http://wp.bieblwerk.de/agentur/
    I´m using a repeater field, are ther any other options? What is my mistake?
    Thank you very much!!!!!!!!

  • Hi Man, I think there is a syntax error in your code. You should check whether there is a field or not (as you’ve done) but you should even check if there are rows. Also when you echo a sub_field sticking it in a variable use get_the_sub_field(). So try the code below and let me know if that’s what you’re looking for 🙂

    <div class="entry-content">
        		<?php the_content(); ?>
    		<?php
    			wp_link_pages( array(
    				'before' => '<div class="page-links">' . __( 'Pages:', 'pictorico' ),
    				'after'  => '</div>',
    			) );
    		?>
            <?php if(get_field('spalten')): ?>
              <?php while(have_rows('spalten')): the_row(); ?>
              <div class="columns">
              <div class="col-left"><?php 
    		  $wysiwyg = get_the_sub_field('linke_spalte', false, false); 
    		  echo apply_filters('the_content', $wysiwyg);
    		  ?></div>
              <div class="col-right"><?php 
    		  $wysiwyg = get_the_sub_field('rechte_spalte', false, false); 
    		  echo apply_filters('the_content', $wysiwyg);
    		  ?></div>
              </div>
              <?php endwhile; ?>
              <?php endif; ?>
    	</div><!-- .entry-content -->

    Also you probably need to make sure there are posts to display so at the very top of it you should do something like:

    <?php
         if(have_posts() ) {
    	while ( have_posts() ) {
    		the_post();
    ?>
    
  • thank you very much!! it is ‘get_sub_field’ and not ‘get_the_sub_field’, but the rest works fine. Great!!

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

The topic ‘LightBox images in custom content field 2’ is closed to new replies.