最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom post types - Accessing download link from the loop with WP Download Manager Pro

programmeradmin1浏览0评论

I'm new to Wordpress, so apologies if this is a silly question.

I am using the WP Download Manager Pro plugin to upload PDF's to wpdmpro post types. A user has to enter an email address in order to download.

In loop.php I loop through all wpdmpro post types and a specified category and tag

<?php
query_posts(array(
    'post_type' => 'wpdmpro',
    'wpdmcategory' => $category->category_nicename,
    'tag' => $cat_tag
));
?>

Now, I want to loop through each post and access the download link attached to post, but I have no idea how to do this? The docs don't seem to outline this anywhere???

<?php if (have_posts()): ?>
    <?php while (have_posts()): the_post(); ?>
        // ... how can i access the download link on the post here?
    <?php endwhile; ?>
<?php endif; ?>

I have tried...

<?php the_content(); ?>

and

<?php 
$post = get_post(); 
$content = apply_filters('the_content', $post->post_content); 
echo $content;  
?>

I am at a loss here!

Any help would be greatly appreciated!

I'm new to Wordpress, so apologies if this is a silly question.

I am using the WP Download Manager Pro plugin to upload PDF's to wpdmpro post types. A user has to enter an email address in order to download.

In loop.php I loop through all wpdmpro post types and a specified category and tag

<?php
query_posts(array(
    'post_type' => 'wpdmpro',
    'wpdmcategory' => $category->category_nicename,
    'tag' => $cat_tag
));
?>

Now, I want to loop through each post and access the download link attached to post, but I have no idea how to do this? The docs don't seem to outline this anywhere???

<?php if (have_posts()): ?>
    <?php while (have_posts()): the_post(); ?>
        // ... how can i access the download link on the post here?
    <?php endwhile; ?>
<?php endif; ?>

I have tried...

<?php the_content(); ?>

and

<?php 
$post = get_post(); 
$content = apply_filters('the_content', $post->post_content); 
echo $content;  
?>

I am at a loss here!

Any help would be greatly appreciated!

Share Improve this question edited Sep 27, 2019 at 15:46 butlerblog 5,1213 gold badges28 silver badges44 bronze badges asked Sep 27, 2019 at 15:34 mcclosamcclosa 1112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You access the file direct link this way:

<?php echo (wpdm_get_package(get_the_ID()))['download_url']; ?>
发布评论

评论列表(0)

  1. 暂无评论