I want to change the "list a service" label based on condition

Hi there,

I hired a developer to help me out with this one, but we’re facing an issue / it doesn’t work. What I want to have:

We simply want to change the slug “Creator werden” (which was “list a service” before) into “Gig erstellen” when the user is logged in.

This is the snippet I’ve tried:

add_filter( 'hivepress/v1/templates/header/menu_items', 'custom_menu_items' );
function custom_menu_items( $items ) {
	if ( is_user_logged_in() ) {
		foreach ( $items as &$item ) {
			if ( 'hivepress/v1/components/listing/list_button' === $item['template'] ) {
				$item['label'] = __( 'Gig erstellen', 'ccfyde' );
	return $items;

You guys may help us with the right hook or info about why that’s not working.


Please try this PHP snippet:

 function($translated_text, $untranslated_text, $domain){
  if('List a Service' !== $untranslated_text || 'taskhive' !== $domain){
   return $translated_text;
   return $translated_text;
  $translated_text = 'Custom text';
  return $translated_text; 

Please note that it can require further customization.


How can I make this same code snippet work for listinghive instead?

In this case it’s easier to use the hivepress/v1/strings filter, it accepts an array of strings - you can check some condition and change the $array['add_listing']=... string.

1 Like

Hi buddy, usually when the code snippet plugin faces an error you can simply go back to the code and it will show you the revision before the crash (or nothing if you added a new code). So after a few seconds your site should be fine.

Hey thanks for writing. Normally I can just click back but this time is first time it wont let me. Worse is that the code snippet plugin in the dashboard completely disappeared. The only way my site actually can be viewed was by deactivate it.

But I found the solution. I actually used my jetpack dashboard recovery and was able to go back to my yesterdays saved version. so all is good now! :grinning:

1 Like