• Hello everyone!
    I’m currently working on my website. I would like to know how can I get the URL of the file attachment?
    For example, I would like to view the pdf file, its url is /wp-content/customer/storage/2fd0ec2d45497aaec0cb8070bc68600b/sample.pdf.

    Here’s my code

    <span><a href="/wp-content/customer-area/storage/2fd0ec2d45497aaec0cb8070bc68600b/sample.pdf" target="_blank"
            title="<?php esc_attr_e('View file', 'textdomain'); ?>" class="btn btn-default btn-sm">
            <span class="fa fa-eye"></span>
           </a>

    I manually attached the file URL since I can’t able to locate each file.

    so the subdirectories after “storage” is dynamic depending on the post file attachment.
    So it goes like this:
    POST TITLE: Sample post
    FILE ATTACHMENT: sample1.pdf
    The url can be: /wp-content/customer/storage/2fd0ec2d45497aaec0cb8070bc68600b/sample1.pdf

    POST TITLE: Sample post 2
    FILE ATTACHMENT: sample2.pdf
    The url can be: /wp-content/customer/storage/2d640d09f7aa5b3ef83439168b7c99ae/sample2.pdf

    Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to get WP-content sub-folders URL’ is closed to new replies.