Tagged: x
-
AuthorPosts
-
November 19, 2016 at 2:34 am #1263442
Cocchini.MDParticipantI’m trying to hide my chat client on some pages. The plugin author gave me this script:
$crisp.do(‘chat:hide’);
On the webpage (while logged out of wordpress), if I right click on the page and go to “inspect” and try this script in the “console” and press enter it does in fact make the chat client disappear.
So I figured then I would just go to cornerstone and paste this script into the page custom js for that page. But it doesn’t work. So I tried it on the global js in customizer and doesn’t work globally either.
What should I do? Thank you!
November 19, 2016 at 2:35 am #1263443
Cocchini.MDParticipantThis reply has been marked as private.November 19, 2016 at 2:56 am #1263451
RadModeratorHi there,
Thanks for posting in.
Is there any explanation on how it should be implemented? I tried it on my browser console and it’s now working.
Thanks!
November 19, 2016 at 7:11 am #1263566
Cocchini.MDParticipantHey thanks. Here’s the authors explanation but it’s pretty narrowly explained.
https://help.crisp.im/answer/how-to-hide-and-show-the-chatbox/
November 19, 2016 at 8:01 am #1263587
ThaiModeratorHi There,
Please add the following code under functions.php file locates in your child theme:
add_action( 'wp_footer', 'x_custom_script' ); function x_custom_script(){ if(is_page( array('123') )){ ?> <script type="text/javascript">$crisp.do('chat:hide');</script> <?php } }Replace 123 number with your page ID.
Hope it helps 🙂
November 19, 2016 at 8:20 am #1263595
Cocchini.MDParticipantYOU ROCK! If this works I’m gonna come hug you guys 🙂 I’ve tried everything
November 19, 2016 at 8:50 am #1263607
Cocchini.MDParticipantThis reply has been marked as private.November 19, 2016 at 7:17 pm #1263930
Rue NelModeratorHello There,
Thanks for the updates! Please do update your code and use this instead:
add_action( 'wp_footer', 'x_custom_script' ); function x_custom_script(){ if(is_page( array('123') )){ ?> <script type="text/javascript"> $(window).load(function(){ $crisp.do('chat:hide'); }); </script> <?php } }Hope this helps. Please let us know how it goes.
November 19, 2016 at 7:59 pm #1263956
Cocchini.MDParticipantThank you guys for trying but that does not seemed to have worked either 🙁
November 20, 2016 at 3:26 am #1264134
Rue NelModeratorHello There,
Thanks for updating in! It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer of the plugin or script.
Thank you for your understanding.
November 20, 2016 at 7:36 am #1264265
Cocchini.MDParticipantI do understand this, and I was expecting this answer at some point. I appreciate the help either way.
With that said, I don’t think it is an issue on their end. The code they offered does in fact work (inspect>console). The issue does seem to be on the Xtheme end in that the working JS entered is not being called properly for some reason. I know this is a gray area, but if you guys could please find it in your heart to give it one more shot, it would mean the world to me. I’m really struggling on this one. I dealt with the plugin developer, tried myself and even worked with a private developer before I contacted you guys. It seems like this is an issue on the theme end, as the code they offered does work when applied to the page in Inspect>Console.
Thank you in advance if you guys can help.
November 20, 2016 at 8:53 am #1264302
ChristianModeratorTo know if this is an issue with X, please try the script on a different theme. Let us know the results.
Thanks.
November 20, 2016 at 1:08 pm #1264466
Cocchini.MDParticipantI tried it on one of my old “myStiemyWay” installs and it did not work either. I guess you win. I’m on my own. Congrats. The “we can’t help because it’s a 3rd party plugin [after we already helped you and it didn’t work]” card reigns supreme again.
For the record. The reason I switched from MySiteMyWay is for the front end editor, but the reason I picked X over Divi or the others is because of you guys. The support. The fact that this used to be a community and not a company. I definitely will not be buying another Xtheme license.
November 20, 2016 at 3:24 pm #1264566
Cocchini.MDParticipant[RESOLVED]
For anyone following this, who is trying to use the Crisp Chat Plugin with xTheme (or any other wordpress theme) here’s the solution to make the chatbox SHOW or HIDE on specific pages.
xTheme, Crisp and a private Dev all failed to figure this out, so I figured it would be worth mentioning how I got it working. This will likely be resolved in Crisp 2 update anyways.
JavaScript (JS) is asynchronous by nature, meaning it loads separately from your website. So all the codes I tried which were intended to stop the chat from opening were not working because of a loading delay (they were loading with the site, not with the chat box). Meaning when someone opens the page, the cascade starts:
– the chat box is told to load (which will take a few seconds)
– then the js code to kill the chat box is called (which may take a few milliseconds)So the chatbox is told to load, then told to not load (while it’s loading). So by the time it finally loads, the kill command is long since over and gone, so the chat loads anyways.
So I figured why not just put the entire chatbox call code in a conditional wrapper. This way the cascade asks the page ID if it should load of not. It does not automatically load and then ask the page ID if it should kill the already loading command. So I frankenhacked some code and it worked. You need to turn off the Crisp plugin (which injects the chatbox code into the header). And erase the chat box code from the header.php file altogether (wp-content/themes/x/framework/views/global/header.php) and paste this instead:
<?php if (is_page(‘123’)): ?>
<!–home page custom JS–>
<script type=”text/javascript”>CRISP_WEBSITE_ID = “33b6673f-516c-4516-a7e0-b15510bbb2da”;(function(){d=document;s=d.createElement(“script”);s.src=”https://client.crisp.im/l.js”;s.async=1;d.getElementsByTagName(“head”)[0].appendChild(s);})();</script>
<?php endif; ?>Just change out ‘123’ with your page ID and this code page will SHOW the chat box, while all other pages on the site will NOT show the chat box. I’m sure you can edit this code to HIDE the chat box only on that page as well. 2 days ago I didn’t know the difference between javascript, java or coffee, so I’m not sure how to do that, but it’s probably as simple as adding a “!” somewhere in the code.
This method will check the page ID first before loading the chatbox launch function. So this should also make your pages load faster as well.
Hope this helps. Since xTheme support won’t be helping out at all, if you need any help message me at [email protected]. Some of us still care about the community, learning and individuals problems.
And for the record, I’m still never buying another xTheme license. I miss the days when you guys would have taken the time to explain a bit and cared enough to finish what you started rather than pull the “3rd party plugin” card when it got too inconvenient. If you do this for a living and you’re stumped, and I’m a doctor building a site in my spare time, imagine how overwhelming it gets on my end.
November 20, 2016 at 7:02 pm #1264757
RadModeratorThanks for sharing, it will be helpful. Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1263442 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
