• Resolved vanduzled

    (@vanduzled)


    I have a CPT UI installed and Polylang. I have translated the items inside the custom post type with no problem, but how can I translate the labels?

    For Example EN -> FR:
    Updates -> mises à jour
    Events -> événements
    Articles – Des articles

    So that I can show on my site the proper label when showing for example:
    mises à jour:
    1. List of Updates in French 1
    2. List of Updates in French 2

    événements:
    1. List of Events in French 1
    1. List of Events in French 2

    Right now, the CPT Dashboard admin doesn’t let met translate the labels even if I change the language (Filter the contents by) in the menu.

    Is there a way to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    The integration with CPTUI is available only in Polylang Pro.

    Otherwise if you register your post types in PHP, you can translate the labels using the usual __() function, as shown in the examples here: https://codex.www.ads-software.com/Function_Reference/register_post_type#Example

    Thread Starter vanduzled

    (@vanduzled)

    Thanks for the reply. I had a solution somehow. I have to get the post type name of the current post and then use an IF statement.

    <?php 
    	$post_type = get_post_type_object($post->post_type);
    	$sname = $post_type->labels->singular_name; 
    ?>
    
    <?php if ( $sname == "Event" ) :
    		$pID = get_page_by_title( 'The Events' ); 
    		$slink = get_permalink( pll_get_post($pID->ID) ); ?>
    		<a id="ID-<?=$pID->ID;?>" title="Click to see more" href="<?=$slink;?>"><?=get_the_title(pll_get_post($pID->ID));?></a>
    
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is there a way to translate Custom Post Type label with Polylang?’ is closed to new replies.