Support » Plugin: Joinchat » Where can I customize a different number for post categories?

  • ermaldina99

    (@ermaldina99)


    Hello there,
    I’ve been diving deep to the settings, but I cannot find an option to add a specific number for category pages.
    In my case: https://prnt.sc/1l6fdne Rooms is one of the categories, and when I go to ‘Edit Category’ there’s no option to customize the Whatsapp number.
    All I get are these options: https://prnt.sc/1l6gcjg
    Can you please help me solving this solution?
    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ermaldina99

    (@ermaldina99)

    Is there any help so far? I need to get a fix solution asap please!!

    Plugin Author Creame

    (@creapuntome)

    Hi!

    You can use a custom code to change phone number for a post category.

    Can use ‘joinchat_get_settings_site’ or ‘joinchat_get_settings’ filters. The first override global join.chat settings and can be changed by post settings. The second filter override the final settings (global and post settings changes).

    You can add this code to your theme functions.php or with a plugin like Code Snippets:

    – A. Change number for ‘room’ category archive and posts with that category:

    add_filter( 'joinchat_get_settings_site', function( $settings, $obj ) {
    	if ( has_category( 'room', $obj ) || is_category( 'room' ) ) {
    		$settings['telephone'] = '+355692888999';
    	}
    	return $settings;
    }, 10, 2 );

    – B. Change number of posts with ‘room’ category:

    add_filter( 'joinchat_get_settings_site', function( $settings, $obj ) {
    	if ( has_category( 'room', $obj ) ) {
    		$settings['telephone'] = '+355692888999';
    	}
    	return $settings;
    }, 10, 2 );
    Thread Starter ermaldina99

    (@ermaldina99)

    Thanks for replying!
    Unfortunately there’s still no changes after I added this piece of code.
    Can you maybe help me more in details please?
    So I’ve edited your code as my desires:

    add_filter( 'joinchat_get_settings_site', function( $settings, $obj ) {
    	if ( has_category( 'Rooms', $obj ) || is_category( 'Rooms' ) ) {
    		$settings['telephone'] = '+355698801181';
    	}
    	return $settings;
    }, 10, 2 );

    The website URL is: https://choosebalkans.com/
    On the header menu, at Accommodations, all the sub-menus are the categories that I want to change the number to the one I provided above in the code.
    Is there any possible way for this to work?
    Could you help me to do this script for all the existing categories for Accommodations?
    Thanks for your time!
    Looking for your answer!
    Greetings, Ermal!

    Thread Starter ermaldina99

    (@ermaldina99)

    Hey!
    I’m sorry but I don’t wanna be annoying, but I’m really stuck in this.
    Can you please check the message above in details?
    Thanks!

    Plugin Author Creame

    (@creapuntome)

    Sorry, it’s not easy to give you a code whitout knowing how is programmed your website.

    The previous code is for standard post type and their categories.

    In your website it seems that use a custom post type “slzexploore_hotel” with a custom term “accommodation”.

    Try whit this code:

    add_filter( 'joinchat_get_settings_site', function( $settings, $obj ) {
    
      // Accommodations slug and related phone number.
      $terms = [
        'rooms'                  => '+355698801111',
        'studio-apartments'      => '+355698801222',
        'one-bedroom-apartments' => '+355698801333',
        'duplex-in-pogradec'     => '+355698801444',
      ];
    
      foreach ($terms as $term => $phone) {
        if ( has_term( $term, 'accommodation', $obj ) || is_tax( $term, 'accommodation' ) ) {
          $settings['telephone'] = $phone;
        }
      }
    
      return $settings;
    }, 10, 2 );
    Thread Starter ermaldina99

    (@ermaldina99)

    Hello there!
    Thanks for your answer!
    Unfortunately it doesn’t work again 🙁
    Can you please message me in WhatsApp to this number: +355674976148, so you can join as admin in my website and then you can clearly see how it’s build and where does the problem stand?
    As I think this has been a really challenging solution for both of us…
    Sorry for taking this much of time, but I hope you are available to join as admin in my site and fix this.
    Best Regards, Ermal!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Where can I customize a different number for post categories?’ is closed to new replies.