Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. function wp_951_new_user_instructions() {
  2. if ( get_post_type() != 'ph-project') {
  3. return;
  4. }
  5. ?>
  6. <script>
  7. function phSetCookie(cname, cvalue, exdays) {
  8. var d = new Date();
  9. d.setTime(d.getTime() + (exdays*24*60*60*1000));
  10. var expires = "expires="+ d.toUTCString();
  11. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  12. }
  13.  
  14. function phGetCookie(cname) {
  15. var name = cname + "=";
  16. var decodedCookie = decodeURIComponent(document.cookie);
  17. var ca = decodedCookie.split(';');
  18. for(var i = 0; i <ca.length; i++) {
  19. var c = ca[i];
  20. while (c.charAt(0) == ' ') {
  21. c = c.substring(1);
  22. }
  23. if (c.indexOf(name) == 0) {
  24. return c.substring(name.length, c.length);
  25. }
  26. }
  27. return "";
  28. }
  29.  
  30. (function ($) {
  31. $(document).ready(function () {
  32. if ( ! phGetCookie('ph-welcome-message') ) {
  33. vex.dialog.alert({
  34. message: '<strong>Welcome!</strong><br>Please point and click to leave comments!'
  35. });
  36. phSetCookie('ph-welcome-message', 1, 45);
  37. }
  38. });
  39. }(jQuery));
  40. </script>
  41. <?php }
  42.  
  43. add_action( 'wp_footer', 'wp_951_new_user_instructions' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement