WordPress.org

Ready to get started?Download WordPress

Forums

WP Publication Archive
[resolved] View and Download Link (2 posts)

  1. LucasMandelli
    Member
    Posted 11 months ago #

    I need to put two links to my PDF files. One of them for viewing in the browser and one for download.
    I have a layout where I show the name of the file and only these two links.
    I did a custom query to list the files, but do not know how to put links in the appropriate buttons.
    Any suggestions how I can get these links?
    Thank you.

    http://fecomerciopr.somainterativa.com.br/institucional/sala-de-imprensa/boletim-diario/

    http://wordpress.org/extend/plugins/wp-publication-archive/

  2. LucasMandelli
    Member
    Posted 11 months ago #

    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>

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.