Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Changer le placeholder du chanp titre, en fonction du Custom Post Type
<?php
/**
* Change le titre par défaut
**/
function tp_custom_title_placeholder( $title )
{
$screen = get_current_screen();
switch( $screen->post_type )
{
case 'FAQ':
$title = __('Enter question here', 'your_domain_name');
break;
case 'Portfolio':
$title = __('Enter client name here', 'your_domain_name');
break;
// ..............
}
return $title;
}
add_filter( 'enter_title_here', 'tp_custom_title_placeholder' );
<?php
/**
* Change le titre du custom post type "Revendeur"
**/
function tp_revendeur_change_default_title( $title )
{
$screen = get_current_screen();
if ( 'revendeur' == $screen->post_type )
$title = 'Code revendeur';
return $title;
}
add_filter( 'enter_title_here', 'tp_revendeur_change_default_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.