Support

Account

Forum Replies Created

  • I solved, I have found and tried this and works:

    This should work for you. Make the field name ‘the_content’. I am wrapping this up into a plugin and will also include the_excerpt, and featured_image.

    paste this in functions.php:

    function hg_acf_save_content( $value, $post_id, $field )
    {
    wp_update_post( array( ‘ID’ => $post_id, ‘post_content’ => $value ) );
    return $value;
    }
    add_filter(‘acf/update_value/name=the_content’, ‘hg_acf_save_content’, 10, 3);

    the only important thing is to name your desired field as:

    the_content

    and works!

  • Hi Jarvis,

    I have the same problem of the first post, I did the following:
    I have pasted this code in functions.php:

    function custom_field_excerpt() {
    global $post;
    $text = get_field(‘extracto’);
    if ( ” != $text ) {
    $text = strip_shortcodes( $text );
    $text = apply_filters(‘the_content’, $text);
    $text = str_replace(‘]]>’, ‘]]>’, $text);
    $excerpt_length = 20; // 20 words
    $excerpt_more = apply_filters(‘excerpt_more’, ‘ ‘ . ‘[…]’);
    $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    }
    return apply_filters(‘the_excerpt’, $text);
    }

    extracto is the name of the field

    and pasted this, in archive.php

    echo custom_field_excerpt();

    but it doesn’t work… the default post element doesn’t recognize this field as the excerpt, I don’t know what is wrong, the field itself must contain some special type or something? right now is a common text field.

    Help please!

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