I resolved it customizing the default excerpt of the post like this:
add_filter( 'get_the_excerpt', 'themeprefix_excerpt_read_more_link' );
function themeprefix_excerpt_read_more_link( $output ) {
global $post;
$yourfield = get_field( "your_field_slug", $post->id );
if( is_tax() ) { // customize output in category
return $output . ' <a href="' . get_permalink( $post->ID ) . '" class="more-link" title="View More">' . $yourfield . ' View More</a>';//change read more text
}
if( is_single() ) { // customize output in single posts
return $output . ' <a href="' . get_permalink( $post->ID ) . '" class="more-link" title="View More"> ' . $yourfield . ' jajajaja</a>';//change read more text
} else { // what all the other type of templates
return $output . ' <a href="' . get_permalink( $post->ID ) . '" class="more-link" title="Read More">Read More</a>';
}
}
Whith this you can manipulate the excerpt in the popover and put any custom field related to the post
I don’t know if it’s the best way, but I think it’s worth it
-
This reply was modified 3 years, 12 months ago by sermalefico.
-
This reply was modified 3 years, 12 months ago by sermalefico.