Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1310425

    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


    Hey 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.


    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,


    I managed to do it with the get_the_excerpt and get_the_category functions.
    Thank you again for your suggestions and help!
    Best regards



    No problem. Please feel free to open another thread if you need anything else.

    Have a nice day.

    Best regards,

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add category and exceprt to related posts elements’ is closed to new replies.