Skip to content

Instantly share code, notes, and snippets.

@pacotole
Created February 19, 2024 18:19
Show Gist options
  • Save pacotole/4f1aa6f7467487a2924232e544343a31 to your computer and use it in GitHub Desktop.
Save pacotole/4f1aa6f7467487a2924232e544343a31 to your computer and use it in GitHub Desktop.
Joinchat always show Chat Window
<?php
/**
* Snippet 1: Set current CTA always as "not viewed".
* Chat Window will show with your Joinchat settings.
*/
add_filter( 'joinchat_get_settings', function( $settings, $obj ) {
$settings['is_viewed'] = false;
return $settings;
}, 10, 2 );
/**
* Snippet 2: Set current CTA if condition as "not viewed".
* Chat Window will show with your Joinchat settings.
*/
add_filter( 'joinchat_get_settings', function( $settings, $obj ) {
if ( is_home() ) $settings['is_viewed'] = false; // Always at home page
if ( is_page( 'contact' ) ) $settings['is_viewed'] = false; // Always at contact page
if ( is_page( array( 34, 56) ) ) $settings['is_viewed'] = false; // Always at pages with IDs
return $settings;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment