Support

Account

Home Forums Add-ons Repeater Field read more

Solving

read more

  • hello sirs

    I have a repeater field with three full wysiwyg fields.

    Is it possible to use the ‘more –>’ link for short and longtext as it works with the standard wp editor field?
    My get_field is placed in the content-single.php in the div ‘entry-content’

    Thanks in advance
    ll.

    • Elliot

    • November 12, 2013 at 4:51 pm

    Hi @lexxlevi

    Yes, it is possible and is explain in this thread:
    http://wordpress.stackexchange.com/questions/50331/advanced-custom-fields-wysiwyg-more-tag

    I’m not sure how this would work with using 3 more tags at once, but this will be up to you to test.

    Thanks
    E

    • jarvis

    • November 12, 2013 at 7:29 pm

    I use this if it helps@

    
    function custom_field_excerpt() {
    	global $post;
    	$text = get_field('overview');
    	if ( '' != $text ) {
    		$text = strip_shortcodes( $text );
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$excerpt_length = 10; // 20 words
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '...');
    		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    	}
    	return apply_filters('the_excerpt', $text);
    }
    function custom_field_excerpt_longer() {
    	global $post;
    	$text = get_field('overview');
    	if ( '' != $text ) {
    		$text = strip_shortcodes( $text );
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$excerpt_length = 25; // 20 words
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '...');
    		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    	}
    	return apply_filters('the_excerpt', $text);
    }

    Just ensure you change this bit to your field name:
    $text = get_field('overview');

    Then to call it I use:
    <?php echo custom_field_excerpt_longer(); ?>

    Cheers

    • lexxlevi

    • November 13, 2013 at 12:27 am

    Thank you for your suggestions. I ´m afraid it is not very clear for me

    This is what I pasted in functions.php

    function custom_field_excerpt() {
    	global $post;
    	$text = the_sub_field('two-col');
    	if ( '' != $text ) {
    		$text = strip_shortcodes( $text );
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$excerpt_length = 10; // 20 words
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '...');
    		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    	}
    	return apply_filters('the_excerpt', $text);
    }
    function custom_field_excerpt_longer() {
    	global $post;
    	$text = the_sub_field('two-col');
    	if ( '' != $text ) {
    		$text = strip_shortcodes( $text );
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$excerpt_length = 25; // 20 words
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '...');
    		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    	}
    	return apply_filters('the_excerpt', $text);
    }

    and this is my repeater set

    	<div class="entry-content">
    		<?php the_content(); ?>
    		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>   
                        <!-- Spalten -->
        <?php if(get_field('set')): ?>
        <div>
          <?php while(has_sub_field('set')): ?>
          <div class="paragraph">
               <div class="two-col">
              <?php the_sub_field('two-col'); ?>
            </div>
            <div class="left-col">
              <?php the_sub_field('left-col'); ?>
            </div>
            <div class="right-col">
              <?php the_sub_field('right-col'); ?>
            </div>
          </div>
          <?php endwhile; ?>
        </div>
        <?php endif; ?>      
    	</div><!-- .entry-content -->

    I ´m not sure how to call the function here

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

You must be logged in to reply to this topic.

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.