Tagged: enfold, posts, related posts
-
AuthorPosts
-
July 16, 2021 at 6:47 pm #1310425
Hello,
I managed to add related posts by modifying the template-builder.php and I also partially modified its structure by modifying related-posts.php. I would like to continue to modify related-posts.php so that in addition to the image and the title, also the category and the summary (should be the excerpt, right?) of the single related posts appear. Is it possible to do this by entering something in this part of the related-posts.php file?$output .= "<div class='$post_class $extra relThumb relThumb{$count} relThumb{$parity} post-format-{$format} related_column'>\n"; $output .= " <a href='".get_permalink($related_post->ID)."' class='relThumWrap noLightbox' title='".esc_attr( avia_wp_get_the_title( $related_post->ID ) )."'>\n"; $output .= " <span class='related_image_wrap' {$insert_tooltip}>"; $output .= $image; $output .= " <span class='related-format-icon {$extra_class}'><span class='related-format-icon-inner' ".av_icon_string($format)."></span></span>"; $output .= " </span>"; $output .= "<h5 class='av-related-title'>" . avia_wp_get_the_title( $related_post->ID ) . "</h5>"; $output .= apply_filters('avf_related_post_loop', "", $related_post); $output .= " </a>"; $output .= "</div>";
Or should I do it in another part of the file? Or maybe should I modify another file?
Thank you- This topic was modified 3 years, 5 months ago by marco_adinolfi.
July 19, 2021 at 6:16 am #1310683Hey marco_adinolfi,
Thank you for the inquiry.
Yes, you could directly add the excerpt in the related-posts.php file along with other post info. You may need to use the get_the_excerpt function.
// https://developer.wordpress.org/reference/functions/get_the_excerpt/
If you do not want to edit the file directly, use the avf_related_post_loop filter instead. Please let us know if you need more assistance.
Best regards,
IsmaelJuly 26, 2021 at 9:42 am #1312340Hello,
I managed to do it with the get_the_excerpt and get_the_category functions.
Thank you again for your suggestions and help!
Best regardsJuly 28, 2021 at 10:38 am #1312991 -
AuthorPosts
- The topic ‘Add category and exceprt to related posts elements’ is closed to new replies.