Ejemplo n.º 1
0
  public function __construct($item) {
    
    global $wf;
    
    parent::__construct($item);
    
    $id = $this->id();
    
    $file_url = wp_get_attachment_url( $id );
    $file_path = WOOF_File::infer_content_path($file_url);

    if (wp_attachment_is_image( $id ) ) {
      $c = $wf->get_image_class();
      $this->file = new $c( $file_path, $file_url );
    } else {
      $c = $wf->get_file_class();
      $this->file = new $c( $file_path, $file_url );
    }
    
  }
Ejemplo n.º 2
0
  public function terms($taxonomy, $fields = array()) {
    
    // allows custom field based related terms to be included in queries
    
    global $wf, $meow_provider;

    $terms = parent::terms($taxonomy);
    
    if ($wf->regard_field_terms()) {
      
      $ids = $meow_provider->outgoing_terms($this, $fields);
      $field_terms = $wf->terms_by_id($ids, $taxonomy);

      if (count($field_terms)) {
        $terms->merge($field_terms, false);
        $terms->dedupe();
      }
      
    }
    
    return $terms;
    
  }