Support » Plugin: WP Live Chat Support » Shortcode? Display only on certain pages.

  • Resolved morgyface

    (@morgyface)


    Hello wise developer people.

    Is there a way of limiting where the chat box displays. At the moment it’s site wide. I only want it to appear on certain posts/pages of my website.

    Perhaps a shortcode I could use like this:

    <?php if ( is_page (1) ) {
    echo do_shortcode('[WPLiveChat]');
    } ?>

    Any suggestions would be helpful.

    https://wordpress.org/plugins/wp-live-chat-support/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP-LiveChat

    (@wp-livechat)

    Hi morgyface

    Unfortunately the chat shows on all pages at the moment, however, we will be releasing an update quite soon whereby you will be able to choose which pages it displays on.

    Kind Regards,
    Jarryd

    morgyface

    (@morgyface)

    Hi Jarryd,

    I am grateful for you getting back to me.

    In the short-term I have done this which acts to remove the plug-in actions from all posts unless they have a category of “stream”.

    function remove_wp_live_chat() {
    if(!in_category('stream')):
    	  remove_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
    	  remove_action('init','wplc_version_control');
    	  remove_action('wp_footer', 'wplc_display_box');
    	  remove_action('init','wplc_init');
    	  if (function_exists('wplc_head_pro')) {
    		  remove_action('admin_head', 'wplc_head_pro');
    	  } else {
    		  remove_action('admin_head', 'wplc_head_basic');
    	  }
    	  remove_action('wp_enqueue_scripts', 'wplc_add_user_stylesheet' );
    	  remove_action('admin_enqueue_scripts', 'wplc_add_admin_stylesheet');
    	  if(function_exists('wplc_admin_menu_pro')){
    		  remove_action('admin_menu', 'wplc_admin_menu_pro');
    	  } else {
    		  remove_action('admin_menu', 'wplc_admin_menu');
    	  }
    	  remove_action('admin_head','wplc_update_chat_statuses');
    	  remove_action('admin_print_scripts', 'wplc_admin_scripts_basic');
    	  remove_action('wp_logout', 'wplc_logout');
    
    	  wp_dequeue_script( 'wplc-user-jquery-cookie' );
    	  wp_dequeue_script( 'wplc-user-script' );
    	  wp_dequeue_script( 'my-wplc-color' );
    	  wp_dequeue_script( 'my-wplc-tabs' );
    	  wp_dequeue_script( 'jquery-ui-tabs' );
    	  wp_dequeue_script( 'jquery-ui-core' );
    	  wp_dequeue_script( 'jquery-ui-draggable' );
    endif;
    }
    
    add_action('wp_head', 'remove_wp_live_chat', 1);

    Seems to work for me.

    But if there’s a better way of doing it I’d appreciate your input.

    Plugin Author WP-LiveChat

    (@wp-livechat)

    Hi morgyface

    We will be releasing an update within the next day or two whereby you can include/exclude the chat window on certain pages.

    Thank you for your patience.

    Kind Regards,
    Jarryd

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode? Display only on certain pages.’ is closed to new replies.