How to display get_post_type() translated?


In my content-search.php template file I did something like this:

<tr id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <td><?php the_post_thumbnail( 'thumbnail' ); ?></td>
    <td style="padding: 15px;">
        echo '<h6>' . ucfirst( get_post_type( get_the_ID() ) ) . '</h6>';
        the_title( sprintf( '<h5><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h5>' ); 
        echo '<p>' . get_the_excerpt() . '</p>';

enter image description here

It returns posts image, post type name in English, title and excerpt on search results page. Posts, pages or another custom post types by searched term. I need to display post type name translated into another language.

Juraj 2 months 0 Answers 12 views 0

Leave an answer