jetpack_post_details_should_run

Determines if Post Details should run.

Description

jetpack_post_details_should_run(); 

Usage

  1. if ( !function_exists( 'jetpack_post_details_should_run' ) ) { 
  2. require_once '/modules/theme-tools/content-options/post-details.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jetpack_post_details_should_run(); 
  7.  

Defined (1)

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

/modules/theme-tools/content-options/post-details.php  
  1. function jetpack_post_details_should_run() { 
  2. // Empty value representing falsy return value. 
  3. $void = array( false, null, null, null ); 
  4.  
  5. // If the theme doesn't support 'jetpack-content-options', don't continue. 
  6. if ( ! current_theme_supports( 'jetpack-content-options' ) ) { 
  7. return $void; 
  8.  
  9. $options = get_theme_support( 'jetpack-content-options' ); 
  10. $post_details = ( ! empty( $options[0]['post-details'] ) ) ? $options[0]['post-details'] : null; 
  11.  
  12. // If the theme doesn't support 'jetpack-content-options[ 'post-details' ]', don't continue. 
  13. if ( empty( $post_details ) ) { 
  14. return $void; 
  15.  
  16. $date = ( ! empty( $post_details['date'] ) ) ? $post_details['date'] : null; 
  17. $categories = ( ! empty( $post_details['categories'] ) ) ? $post_details['categories'] : null; 
  18. $tags = ( ! empty( $post_details['tags'] ) ) ? $post_details['tags'] : null; 
  19. $author = ( ! empty( $post_details['author'] ) ) ? $post_details['author'] : null; 
  20.  
  21. // If there is no stylesheet and there are no date, categories, tags or author declared, don't continue. 
  22. if ( empty( $post_details['stylesheet'] ) 
  23. && ( empty( $date ) 
  24. || empty( $categories ) 
  25. || empty( $tags ) 
  26. || empty( $author ) ) ) { 
  27. return $void; 
  28.  
  29. $date_option = get_option( 'jetpack_content_post_details_date', 1 ); 
  30. $categories_option = get_option( 'jetpack_content_post_details_categories', 1 ); 
  31. $tags_option = get_option( 'jetpack_content_post_details_tags', 1 ); 
  32. $author_option = get_option( 'jetpack_content_post_details_author', 1 ); 
  33.  
  34. $options = array( $date_option, $categories_option, $tags_option, $author_option ); 
  35. $definied = array( $date, $categories, $tags, $author ); 
  36.  
  37. // If all the options are ticked, don't continue. 
  38. if ( array( 1, 1, 1, 1 ) === $options ) { 
  39. return $void; 
  40.  
  41. return array( true, $options, $definied, $post_details );