jetpack_post_details_enqueue_scripts

The function to include Post Details in a theme's stylesheet.

Description

jetpack_post_details_enqueue_scripts(); 

Usage

  1. if ( !function_exists( 'jetpack_post_details_enqueue_scripts' ) ) { 
  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_enqueue_scripts(); 
  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_enqueue_scripts() { 
  2. // Make sure we can proceed. 
  3. list( $should_run, $options, $definied, $post_details ) = jetpack_post_details_should_run(); 
  4.  
  5. if ( ! $should_run ) { 
  6. return; 
  7.  
  8. list( $date_option, $categories_option, $tags_option, $author_option ) = $options; 
  9. list( $date, $categories, $tags, $author ) = $definied; 
  10.  
  11. $elements = array(); 
  12.  
  13. // If date option is unticked, add it to the list of classes. 
  14. if ( 1 != $date_option && ! empty( $date ) ) { 
  15. $elements[] = $date; 
  16.  
  17. // If categories option is unticked, add it to the list of classes. 
  18. if ( 1 != $categories_option && ! empty( $categories ) ) { 
  19. $elements[] = $categories; 
  20.  
  21. // If tags option is unticked, add it to the list of classes. 
  22. if ( 1 != $tags_option && ! empty( $tags ) ) { 
  23. $elements[] = $tags; 
  24.  
  25. // If author option is unticked, add it to the list of classes. 
  26. if ( 1 != $author_option && ! empty( $author ) ) { 
  27. $elements[] = $author; 
  28.  
  29. // Get the list of classes. 
  30. $elements = implode( ', ', $elements ); 
  31.  
  32. // Hide the classes with CSS. 
  33. $css = $elements . ' { clip: rect(1px, 1px, 1px, 1px); height: 1px; position: absolute; overflow: hidden; width: 1px; }'; 
  34.  
  35. // Add the CSS to the stylesheet. 
  36. wp_add_inline_style( $post_details['stylesheet'], $css );