Advertisement
Guest User

Untitled

a guest
May 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. <?php
  2. /**
  3. * Child theme functions
  4. *
  5. * When using a child theme (see http://codex.wordpress.org/Theme_Development
  6. * and http://codex.wordpress.org/Child_Themes), you can override certain
  7. * functions (those wrapped in a function_exists() call) by defining them first
  8. * in your child theme's functions.php file. The child theme's functions.php
  9. * file is included before the parent theme's file, so the child theme
  10. * functions would be used.
  11. *
  12. * Text Domain: oceanwp
  13. * @link http://codex.wordpress.org/Plugin_API
  14. *
  15. */
  16.  
  17. /**
  18. * Load the parent style.css file
  19. *
  20. * @link http://codex.wordpress.org/Child_Themes
  21. */
  22. function oceanwp_child_enqueue_parent_style() {
  23. // Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)
  24. $theme = wp_get_theme( 'OceanWP' );
  25. $version = $theme->get( 'Version' );
  26. // Load the stylesheet
  27. wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );
  28.  
  29. }
  30. add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );
  31.  
  32. add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' );
  33. function my_comment_form_field_comment( $comment_field ) {
  34. return $comment_field.'<p class="pprivacy"><label for="pprivacy"><input type="checkbox" style="width:30px" name="privacy" value="Privacidad Aceptada" class="privacyBox" aria-req="true">He leido y acepto <a target="blank" href="https://www.monetizados.com/privacidad/">la política de privacidad</a></label><p>';
  35. }
  36. //javascript validation
  37. add_action('wp_footer','valdate_privacy_comment_javascript');
  38. function valdate_privacy_comment_javascript(){
  39. if (! is_admin() && is_single() && comments_open() ){
  40. wp_enqueue_script('jquery');
  41. ?>
  42. <script type="text/javascript">
  43. jQuery(document).ready(function($){
  44. $("#submit").click(function(e)){
  45. if (!$('.privacyBox').prop('checked')){
  46. e.preventDefault();
  47. alert('Debes confirmar que estás de acuerdo con nuestra política de privacidad marcando la "cajita" ....<p><a href="javascript:history.back()">' . __('&laquo; Volver') . '</a></p>');
  48. return false;
  49. }
  50. }
  51. });
  52. </script>
  53. <?php
  54. }
  55. }
  56.  
  57. //no js fallback validation
  58. add_filter( 'preprocess_comment', 'verify_comment_privacy' );
  59. function verify_comment_privacy( $commentdata ) {
  60. if ( ! isset( $_POST['privacy'] ) && ! is_admin() )
  61. wp_die( __( 'Error: Debes confirmar que estás de acuerdo con nuestra política de privacidad marcando la "cajita" ..... <p><a href="javascript:history.back()">' . __('&laquo; Volver') . '</a></p>' ) );
  62.  
  63. return $commentdata;
  64. }
  65.  
  66. // Guardamos el valor aceptado en la tabla comment metadata
  67. function save_comment_meta_data ( $post_id ) {
  68. $privacy_comment = $_POST['privacy'];
  69. if ( $privacy_comment ) {
  70. add_comment_meta( $post_id, 'privacy', $privacy_comment, true );
  71. }}
  72.  
  73. add_action( 'comment_post', 'save_comment_meta_data', 1 );
  74.  
  75. // Mostramos el valor del metadato en la página de administración de comentarios
  76. if ( is_admin() ) {
  77. function show_commeta() {
  78. echo get_comment_text(), '<br><br><strong>', get_comment_meta(get_comment_ID(), 'privacy',1), '<strong>';
  79. }
  80. add_action('comment_text', 'show_commeta');
  81. }
  82.  
  83. function hormi_change_note_after_comment_form($arg) {
  84. $arg['comment_notes_after'] = '<p class="comment-notes">Responsable: Monetizados online SL, siendo la Finalidad; envío de mis publicaciones así como correos comerciales. La Legitimación; es gracias a tu consentimiento. Destinatarios: tus datos se encuentran alojados en mis plataformas de email marketing Active Campaign ubicada en EEUU y acogida al Privacy Shield. Podrás ejercer Tus Derechos de Acceso, Rectificación, Limitación o Suprimir tus datos en contacto@monetizados.com. Para más información consulte nuestra <a target="blank" href="https://www.monetizados.com/privacidad/">política de privacidad</a>;
  85. return $arg;
  86. }
  87.  
  88. add_filter('comment_form_defaults', 'hormi_change_note_after_comment_form');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement