Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. add_filter( 'wpsight_listing_title_actions', 'wpsight_listing_title_action_contact' );
  2. function wpsight_listing_title_action_contact( $actions ) {
  3.    
  4.         $args = array(
  5.             'include'        => $include,
  6.             'post_status'    => 'inherit',
  7.             'post_type'      => 'attachment',
  8.             'post_mime_type' => 'application/pdf',
  9.             'order'          => $order,
  10.             'orderby'        => $orderby
  11.         );    
  12.    
  13.         $args = apply_filters( 'wpsight_image_slider_args', $args);
  14.         $_attachments = get_posts( $args );
  15.  
  16.         $attachments = array();
  17.        
  18.         $postid = get_the_ID();
  19.         $url = 'leer';
  20.        
  21.         foreach ( $_attachments as $k => $v ) {
  22.             $attachments[$v->ID] = $_attachments[$k];
  23.             //print_r($attachments[$v->ID]);
  24.             if($postid == $attachments[$v->ID]->post_parent){
  25.                 $url = $attachments[$v->ID]->guid;
  26.             }
  27.         }
  28.        
  29.         if($url == 'leer'){
  30.             $url = esc_url( add_query_arg( array(  'pid' => get_the_ID(), 'print' => '1' ), get_permalink() ) );
  31.         }
  32.  
  33. $actions = array(
  34.     'favorites' => array(
  35.         'label'     => __( 'Save', 'wpsight' ),
  36.         'name'      => false,
  37.         'id'        => false,
  38.         'class'     => 'btn btn-mini actions-favorites action-link',
  39.         'href'      => false,
  40.         'target'    => false,
  41.         'icon'      => 'icon-star',
  42.         'atts'      => false,
  43.         'position'  => 10,
  44.         'cb'        => 'wpsight_listing_title_action_favorite'
  45.     ),
  46.    
  47.     'print' => array(
  48.         'label'     => __( 'Print', 'wpsight' ),
  49.         'name'      => false,
  50.         'id'        => false,
  51.         'class'     => 'btn btn-mini',
  52.         //'href'        => esc_url( add_query_arg( array(  'pid' => get_the_ID(), 'print' => '1' ), get_permalink() ) ),
  53.                 'href'          => $url,
  54.         'target'    => 'blank',
  55.         'icon'      => 'icon-print',
  56.         'atts'      => false,
  57.         'position'  => 20,
  58.         'cb'        => false
  59.     )      
  60. );
  61.     return $actions;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement