Guest User

Untitled

a guest
Apr 23rd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. add_filter( 'vcex_blog_grid_media', function( $output, $atts ) {
  2.  
  3. if ( isset( $atts[ 'classes' ] ) && 'mycustom-classname' == $atts['classes'] ) {
  4. if ( $secondary = get_post_meta( get_the_ID(), 'wpex_secondary_thumbnail', true ) ) {
  5. $secondary_image = wpex_get_post_thumbnail( array(
  6. 'attachment' => $secondary,
  7. 'size' => isset( $atts['img_size'] ) ? $atts['img_size'] : '',
  8. 'width' => isset( $atts['img_width'] ) ? $atts['img_width'] : '',
  9. 'height' => isset( $atts['img_height'] ) ? $atts['img_height'] : '',
  10. 'crop' => isset( $atts['img_crop'] ) ? $atts['img_crop'] : '',
  11. 'class' => 'vcex-blog-entry-img',
  12. 'apply_filters' => 'vcex_blog_grid_thumbnail_args',
  13. 'filter_arg1' => $atts,
  14. ) );
  15. return '<div class="vcex-blog-entry-media entry-media"><a href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( get_the_title() ) . '">'. $secondary_image . '</a></div>'; // override media with first image
  16. }
  17. }
  18.  
  19. return $output;
  20.  
  21. }, 10, 2 );
Add Comment
Please, Sign In to add comment