cf7_style_set_style_category_on_publish

The Contact Form 7 Style cf7 style set category on publish function.

Description

cf7_style_set_style_category_on_publish( $ID, $post ); 

Parameters (2)

0. $id
The id.
1. $post
The post.

Usage

  1. if ( !function_exists( 'cf7_style_set_style_category_on_publish' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-style/cf7-style.php'; 
  3.  
  4. // The id. 
  5. $id = null; 
  6.  
  7. // The post. 
  8. $post = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cf7_style_set_style_category_on_publish($id, $post); 
  12.  

Defined (1)

The function is defined in the following location(s).

/cf7-style.php  
  1. function cf7_style_set_style_category_on_publish( $ID, $post ) { 
  2. $temporizator = 0; 
  3. foreach ( get_predefined_cf7_style_template_data() as $predefined_post_titles ) { 
  4. if( $post->post_title == $predefined_post_titles[ "title" ] ) { 
  5. $temporizator++; 
  6. }  
  7. if( 0 == $temporizator ) { 
  8. wp_set_object_terms( $ID, 'custom style', 'style_category' ); 
  9. } // end cf7_style_set_style_category_on_publish