Viewing 1 replies (of 1 total)
  • Thread Starter LucasMandelli

    (@lucasmandelli)

    I was able to do what I wanted.
    It was enough just to create an object of the WP_Publication_Archive_Item class and call the method get_the_link () which returns the preview link and I created the get_the_download_link () method that returns the download link.

    lib/class.publication-markup.php:

    /**
    * Get the file open link for the current publication.
    *
    * @return string Download link.
    *
    * @see WP_Publication_Archive::get_open_link()
    */
    public function get_the_link() {
        return WP_Publication_Archive::get_open_link( $this->ID );
    }
    
    /**
    * Get the file open link for the current publication.
    *
    * @return string Download link.
    *
    * @see WP_Publication_Archive::get_download_link()
    */
    public function get_the_download_link() {
        return WP_Publication_Archive::get_download_link( $this->ID );
    }

    view page:

    $obj = new WP_Publication_Archive_Item(get_the_ID());
    <a href="<?php echo $arquivo->get_the_link(); ?>" target="_blank">view</a>
    <a href="<?php echo $arquivo->get_the_download_link(); ?>" target="_blank">download</a>

Viewing 1 replies (of 1 total)
  • The topic ‘View and Download Link’ is closed to new replies.