Support » Fixing WordPress » Custom Download Widget: making Downloads Monitor work with Advanced Custom Field

  • I cannot find an appropriate plugin for this, but I want to have a related downloads list on various sidebars that are specifically related to the current page/post. Suppose an article has a presentation & questionnaire for downloads. I want them to appear in my sidebar on that page. I’m currently using Advanced Custom Fields (ACF) and Downloads-Monitor (DLM).

    I want this to be something that the user either tags the appropriate post from the download manager, or tags the appropriate download link from the post. Perhaps there’s an existing plugin that I’m unaware of?

    I added a document to the DLM and tried adding a custom field called “related_download” with a value of the slug for the page I’m testing (i.e. events). I attempted to call the new field and see if it matches what the current page’s slug is. If it does, run the proceeding code for the list.

    <div class="widget widget_related_docs">
      <h4>Related Downloads</h4>
      <div class="side-content">
        <ul>
          <?php echo do_shortcode('[downloads category=related-download order=ASC template="my-template"]'); ?>
        </ul>
      </div>
    </div>
    <?php
    /**
     * Detailed download output
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
        exit;
    } // Exit if accessed directly
    
    if ( $dlm_download->get_field('related_download') ) :
      global $post; // get the post meta and search for slug
      $post_slug = $post->post_name;
    
      if ( $dlm_download->the_field('related_download') = $post_slug ) :
    
    ?>
    
    <li>
      <a href="<?php $dlm_download->the_download_link();?>" target="_blank"><?php $dlm_download->the_title();?></a>
    </li>
    
    <?php 
    
      endif;
    endif;
    
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.