1. Docs
  2. Developer Guide
  3. Miscellaneous and Snippets
  4. Change the name of departments

Change the name of departments

By default the departments available in Property Hive are as follows:

Residential Sales
Residential Lettings
Commercial

Sometimes, we might want to change these to match the website that Property Hive is being used on. We can change these labels globally by adding the following to our theme’s functions.php file.

add_filter( 'gettext', 'theme_change_department_names', 20, 3 );
function theme_change_department_names( $translated_text, $text, $domain ) {
 
    switch ( $translated_text ) 
    {
        case 'Residential Sales' :
        {
            $translated_text = __( 'Sales', 'propertyhive' );
            break;
        }
        case 'Residential Lettings' :
        {
            $translated_text = __( 'Lettings', 'propertyhive' );
            break;
        }
        case 'Commercial' :
        {
            $translated_text = __( 'Serviced Apartments', 'propertyhive' );
            break;
        }
    }
 
    return $translated_text;
}
Was this article helpful to you? Yes No