WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
[resolved] get_attachment_url (3 posts)

  1. Ronald
    Member
    Posted 2 years ago #

    hi
    I'm using "WP User Frontend" for my ebook-library website.
    when I attached the pdf, the plugin automatically generate like the below codes

    <ul class="wpuf-attachments"><li><a href="localhost/wp-content/uploads/2013/01/mypdf.pdf" title="mypdf">mypdf</a></li></ul>

    here I just only want the attachment URL , so how can I call it in the loop
    as I'm beginner, I don't know how the plugin codes work at the background process.
    if someone could help me thanks

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. Ronald
    Member
    Posted 2 years ago #

    actually I want to embed like this
    <embed src="http://localhost/wp-content/uploads/2013/01/mypdf.pdf" width="100%" height="700">

    even I do like this, nothing has come up
    <?php wp_get_attachment_url($attachment->ID, 'wpuf_file', true ); ?>
    may be I don't know to attachment slug name

    waiting for the answer

  3. Ronald
    Member
    Posted 2 years ago #

    uhh , fixed it by myself :D

    <?php
    $args = array(
        'post_type' => 'attachment',
        'numberposts' => null,
        'post_status' => null,
        'post_parent' => $post->ID
    );
    $attachments = get_posts($args);
    if ($attachments) {
        foreach ($attachments as $attachment) {
            echo wp_get_attachment_url($attachment->ID, '');
        }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic