Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thierrypigot/704267289c927729bd94 to your computer and use it in GitHub Desktop.
Save thierrypigot/704267289c927729bd94 to your computer and use it in GitHub Desktop.
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