Main Menu
Sub Menu

wpdm_get_package

Description:

Takes a package ID and returns the database record for that package.

Usage:

<?php wpdm_get_package($id); ?>

Return Value:

Return package data in an Array if package exists

Example:

To get the title for a post with ID 2:

<?php 
   $package = wpdm_get_package(2); 
   echo $package['post_title']; 
?>

To get the download count:

<?php echo $package['download_count']; ?>

Using new API

If you want to load package data in an object, use the following code:

<?php $package = WPDM()->package->init($ID); ?>

Here are the variables in $package object you can access directly:

<?php

class Package
{
    public $ID;
    public $title;
    public $description;
    public $excerpt;
    public $files;
    public $post_status;
    public $version;
    public $publish_date;
    public $publish_date_timestamp;
    public $update_date;
    public $update_date_timestamp;
    public $avail_date;
    public $expire_date;
    public $link_label;
    public $download_count;
    public $view_count;
    public $access;
    public $author;
    public $quota;
    public $icon;
    public $package_size;
}

?>

Show file list table:

<?php echo WPDM()->package->fileList->table($ID); ?>

File list extended:

<?php echo WPDM()->package->fileList->extended($ID, 400, 300, 4); ?>

Image gallery from attached images:

<?php echo WPDM()->package->fileList->imageGallery($ID, 400, 300, 4); ?>

Check if a package is locked:

<?php $locked = WPDM()->package->isLocked($ID); ?>

Check if a package is locked using a specific lock option ( ex: is terms locked? ):

<?php $must_agree_to_download = WPDM()->package->isLocked($ID, 'terms'); ?>

Check if a package is password protected:

<?php $password_protected = WPDM()->package->isPasswordProtected($ID); ?>
Last updated on Jul 8, 2021

Need More Clarification?

For any technical issue, if you are already using pro version please post in pro forum and free version users please post in free forum. Otherwise, if you have any pre-sale or order related query please contact live chat support team. For technical support.

Need Customization?

If you need additional customization on WordPress Download Manager or any type of custom support on WordPress you may contact our customization service.