layers_post_featured_media

The Layers layers post featured media function.

Description

layers_post_featured_media( (array) $args = array() ); 

Parameters (1)

0. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'layers_post_featured_media' ) ) { 
  2. require_once '/core/helpers/post.php'; 
  3.  
  4. // The args. 
  5. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = layers_post_featured_media($args); 
  9.  

Defined (1)

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

/core/helpers/post.php  
  1. function layers_post_featured_media( $args = array() ) { 
  2. global $post; 
  3. $defaults = array ( 
  4. 'postid' => $post->ID,  
  5. 'wrap' => 'div',  
  6. 'wrap_class' => 'thumbnail',  
  7. 'size' => 'medium',  
  8. 'hide_href' => false 
  9. ); 
  10.  
  11. $args = wp_parse_args( $args, $defaults ); 
  12. extract( $args, EXTR_SKIP ); 
  13.  
  14. $post_meta = get_post_meta( $postid, 'layers', true ); 
  15.  
  16. $featured_media = layers_get_feature_media( get_post_thumbnail_id( $postid ), $size, ( isset( $post_meta[ 'video-url' ] ) ? $post_meta[ 'video-url' ] : NULL ), $postid ); 
  17.  
  18. if( NULL == $featured_media ) return; 
  19.  
  20. $output = ''; 
  21.  
  22. if( NULL != $featured_media ) { 
  23. $output .= $featured_media; 
  24.  
  25. if( TRUE != $hide_href ) { 
  26. if( has_post_thumbnail() ) { 
  27. if( !is_single() ) { 
  28. $output = '<a href="' .get_permalink( $postid ) . '">' . $output . '</a>'; 
  29.  
  30. if( '' != $wrap ) { 
  31. $output = '<'.$wrap. ( '' != $wrap_class ? ' class="' . $wrap_class . '"' : '' ) . '>' . $output . '</' . $wrap . '>'; 
  32.  
  33. return apply_filters('layers_post_featured_media', $output);