Open files in a new tab

Viewing 11 posts - 1 through 11 (of 11 total)
#159771

Hudi Webcart
Participant

Hi,
Can not open file in a new tab as before.
I changed /wp-content/themes/astra/footer.php

<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the #content div and all content after.
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Astra
 * @since 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

?>
<?php astra_content_bottom(); ?>
	</div> <!-- ast-container -->
	</div><!-- #content -->
<?php 
	astra_content_after();
		
	astra_footer_before();
		
	astra_footer();
		
	astra_footer_after(); 
?>
	</div><!-- #page -->
<?php 
	astra_body_bottom();    
	wp_footer(); 
?>
<script>
jQuery(function($){
    $('.wpdm-download-link').each(function(){
         $(this).attr('target','_blank');
    });
});
</script>

	</body>
</html>

I changed /wp-content/plugins/download-manager/src/Package/views/link-templates/link-template-default.php

<!-- WPDM Link Template: Default Template -->

<div class="link-template-default card mb-2">
    <div class="card-body">
        <div class="media">
            <div class="mr-3 img-48">[icon]</div>
            <div class="media-body">
                <h3 class="package-title">[page_link]</h3>
                <div class="text-muted text-small"><i class="fas fa-copy"></i> [file_count] [txt=file(s)] <i class="fas fa-hdd ml-3"></i> [file_size]</div>
            </div>
            <div class="ml-3">
                <a href="[download_url]" class="btn btn-primary" target="_blank">[link_label]</a>
            </div>
        </div>
    </div>
</div>

And I changed /wp-content/plugins/download-manager/src/Package/views/page-templates/page-template-default.php

<!-- WPDM Template: Default Template -->
<div class="row">
    <div class="col-md-12">
        <div class="card mb-3 p-3 hide_empty [hide_empty:featured_image]">[featured_image]</div>
    </div>
    <div class="col-md-5">
        <div class="wpdm-button-area mb-3 p-3 card">
         <a href="[download_url]" class="btn btn-primary" target="_blank">[link_label]</a>
            <div class="alert alert-warning mt-2 [hide_empty:expire_date]">
                Download is available until [expire_date]
            </div>
        </div>
        <ul class="list-group ml-0 mb-2">
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:version]">
                [txt=Version]
                <span class="badge">[version]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:download_count]">
                [txt=Download]
                <span class="badge">[download_count]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:file_size]">
                [txt=File Size]
                <span class="badge">[file_size]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:file_count]">
                [txt=File Count]
                <span class="badge">[file_count]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:create_date]">
                [txt=Create Date]
                <span class="badge">[create_date]</span>
            </li>
            <li class="list-group-item  d-flex justify-content-between align-items-center [hide_empty:update_date]">
                [txt=Last Updated]
                <span class="badge">[update_date]</span>
            </li>

        </ul>
    </div>

    <div class="col-md-7">
        <h1 class="mt-0">[title]</h1>
        [description]

        <div class="wel">
            [tags]
        </div>

    </div>

</div>

But it still opens files on the same tab and not in a new tab.

  • This topic was modified 3 years, 8 months ago by Shahjada. Reason: creds removed
#159783

Tanvir
Spectator

Hello @hudi-webcart,
You just need to follow this:

1. Copy page-templates directory from /plugins/download-manager/src/package/views directory to your active theme directory.
2. Make a new directory as download-manager on your active theme directory.
3. Now remove all files from {active-theme}/download-mamager/page-templates except the template files you need to update.
4. Update template file(s) in {active-theme}/download-manager/page-templates directory as per your need. As you need to add open in a new tab you have to add this <a href="[download_url]" target="_blank">[link_label]</a>

Let me know please if you still find any issues.

Thanks

#159844

Hudi Webcart
Participant

Hi,
Many thanks for the instructions.
Unfortunately the files still being opened in the same tab.
I did NOT add the JS mentioned here in footer.php – if needed, pls let me know.

#159846

Shahjada
Keymaster
This reply has been marked as private.
#159883

Hudi Webcart
Participant

OK. Thanks for adding.
But still files open in same tab.

#159884

Shahjada
Keymaster

Please give me an URL where the download link opens on the same tab for you. In my test ( https://flowersoapscoil.ipage.com/aitech/test/?search=p ), it is opening in a new tab.

#159885

Hudi Webcart
Participant
This reply has been marked as private.
#159887

Shahjada
Keymaster

LOL, you meant tree view shortcode, we already documented it on https://www.wpdownloadmanager.com/download/wpdm-extended-short-codes/. Simply adding newwin=1 with shortcode shall open the link in a new window/tab.

#159888

Hudi Webcart
Participant

Amazing!
I see you already add it and now it works well!!!
Thanks a lot for the patience and help!
Such a wonderful support. Great job!

By the way, can you mark private post ##159771 with the cred.

#159920

Humayon
Spectator

Hi @hudi-webcart,
I see the post with cred is already marked as private.
However, If you found our support helpful, could you leave your valuable review here?
Your rating keeps us inspired.
Thank You

#159921

Hudi Webcart
Participant

Thanks and sure I will give my 5 stars.

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘Open files in a new tab’ is closed to new replies.