Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php }
  2. }
  3.  
  4. //Define the key to store in the database
  5. define( 'CF7_COUNTER', 'cf7-counter' );
  6.  
  7. //Create the shortcode which will set the value for the DTX field
  8. function cf7dtx_counter(){
  9. $val = get_option( CF7_COUNTER, 0) + 1; //Increment the current count
  10. return $val;
  11. }
  12. add_shortcode('CF7_counter', 'cf7dtx_counter');
  13.  
  14. //Action performed when the mail is actually sent by CF7
  15. function cf7dtx_increment_mail_counter(){
  16. $val = get_option( CF7_COUNTER, 0) + 1; //Increment the current count
  17. update_option(CF7_COUNTER, $val); //Update the settings with the new count
  18. }
  19. add_action('wpcf7_mail_sent', 'cf7dtx_increment_mail_counter'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement