• Resolved Jakes

    (@johanppmedia)


    Hi there,

    I’m building out a project for a client and was wondering if we can dynamically populate Download entries with a loop?

    End results:

    Create new download
    Download automatically added to archive page inside a loop (Like a Blog archive page)

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author mkscripts

    (@mkscripts)

    Hi,

    Yes that is possible, although the downloads (custom post type) are shortcode-driven (and not publicly queryable). In your custom template file you could run a secondary query to get the ids of your published downloads. You can then display the download forms using the do_shortcode() function.

    <?php
    
    $my_query = new WP_Query( array(
        'post_type'		=> 'dae_download',
        'fields'		=> 'ids',
        'post_status'	=> 'publish'
    ) );
    
    if ( $my_query->have_posts() ) {
    
        foreach ( $my_query->get_posts() as $download_id ) {
            echo do_shortcode( '[download_after_email id="' . $download_id . '"]' );
        }
    
    }
    
    wp_reset_postdata();
    
    ?>

    You can find more information about using multiple queries here.

    If you have any more questions, feel free to ask.

    Kind regards,
    Team Download After Email

Viewing 1 replies (of 1 total)
  • The topic ‘Can we use Download entries inside a page archive loop?’ is closed to new replies.