Support » Plugin: WordPress Download Manager » How to show PDF links of a specific category in page template

  • Resolved sideeq313

    (@sideeq313)


    Hi,
    I really like the download manager plugin and it’s working is good. I have looking to show the attached files of a specific category in my page template. please help me if any option available to show the same. I have tested the below code, but not showing the attachment.

    —————————–

    <?php query_posts( array( 'post_type' => 'wpdmpro', 'wpdmcategory' => 'english' ) );  ?>
              
              
              <?php while (have_posts()) : the_post(); ?>
               <?php the_title() ?>
              <?php the_content() ?>
    
              <?php endwhile; ?>
              <?php wp_reset_query();?> 
    • This topic was modified 1 month, 2 weeks ago by  sideeq313.
    • This topic was modified 1 month, 2 weeks ago by  sideeq313.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor W3 Eden, Inc.

    (@w3eden)

    The query parameters should be like this:

    array(
    	'post_type' => 'wpdmpro',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'wpdmcategory',
    			'field'    => 'slug',
    			'terms'    => 'english'
    		),
    	),
    )

    Hi,
    Thank you for your quick replay,
    I have tried the above code, but the attachment inside the category or slug is not showing.

    please verify my tested code.

    <?php 
    
                            array(
                            'post_type' => 'wpdmpro',
                            'tax_query' => array(
                              array(
                                'taxonomy' => 'wpdmcategory',
                                'field'    => 'slug',
                                'terms'    => 'english'
                              ),
                            ),
                          )
                        ?>
    
                      <?php while (have_posts()) : the_post(); ?>
                      <?php the_content() ?>
                      <?php endwhile; ?>
                      <?php wp_reset_query();?> 

    Please have a look at the attachment and help me in resolving the issue.

    2019-01-31_1250

    hi,
    the above code is taking the custom taxonomy data. right!!. so how to display the attach file meta box inside the while loop.
    please check the screenshot.
    2019-02-03_0936

    Plugin Author Shahjada

    (@codename065)

    Hi,
    Please follow the doc here https://www.wpdownloadmanager.com/doc/function-reference/get_package_data/ to read any download info. But if you want to add download URL, you have to use the following code:
    echo \WPDM\Package::getDownloadURL(get_the_ID());
    There is also another way to do this using a link template, please follow the steps:

    1. Copy /plugins/download-manager/tpls/ dir to your active theme dir
      Rename it to download-manager
    2. Go to {active-theme}/download-mamager/link-templates
    3. Open link-template-calltoaction3.php
    4. Remove the tags you don’t need ( Available template tags: https://www.wpdownloadmanager.com/doc/templates/template-tags/ ).
    5. Inside your loop, just use the following code:
      <?php echo do_shortcode("[wpdm_package id=".get_the_ID()." template='link-template-calltoaction3.php']"); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.