Support » Plugin: List category posts » Advanced Custom Fields in List category posts excerpt

  • end3r.w


    I’ve been having issue with this for the past two weeks.

    Does anyone know how to to this ?

    i found solution to show advanced custom fields excerpt in category posts view and on single post, but had no luck in showing it on list category posts excerpt.

    this is the solution i found on with regards to displaying excerpt :

    putting this in fuction.php :

    function custom_field_excerpt() {
    global $post;
    $text = get_field(‘field_name’);
    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);

    putting this inside loop.php
    <?php echo custom_field_excerpt(); ?>

    if i put this under single blog post in loop it works, if i put this inside blog posts loop it doesnt show it.

    Does anyone have solution for this ? am i putting this inside wrong file ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am no expert on this here, and not sure if found an answer, but I think that since this is a plugin and they write their own custom functions that work in tandem with their plugin that you would need to write this code in the plugin and not the functions.php file. Doing it at the theme level won’t help you in the shortcode understanding what you are telling the theme to do better.

    I am looking into doing the same thing and found that the file you would need to add this theme function to is named CatListDisplayer.php inside editing the plugin. Again I know little about this, so there might be a more direct way of doing this that is safer along the way, like making something similar to a child plugin of some sort, if that is even done.

    you wuld also need ot add the function name into the shortcode list in the list_cat_posts.php file.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Advanced Custom Fields in List category posts excerpt’ is closed to new replies.