• Resolved aktivist

    (@aktivist)


    Hi! Thanks for awesome plugin!

    Can you help me with getting the attached image in a custom template via php similar to

    echo get_comment_meta( $comment->comment_ID, 'custom_field', true );

    TIA

    • This topic was modified 4 years, 11 months ago by aktivist.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Denis Yanchevskiy

    (@denisco)

    Hello @aktivist,

    I’m glad the plugin helped you.

    If you want to get an attached image, you can use something like this:
    <?= dco_ca()->display_attachment(''); ?>

    If you need to get exactly the image url, then try this:

    <?php
    $attachment_id = dco_ca()->get_attachment_id();
    $url = wp_get_attachment_url( $attachment_id );
    echo $url;
    ?>
    Thread Starter aktivist

    (@aktivist)

    Thanks a million, Denis! С новым годом!
    I also did solve it with such a snippet:
    echo wp_get_attachment_image( get_comment_meta( $comment->comment_ID, 'attachment_id', true ), $thumbnail_size );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get attachment url via php’ is closed to new replies.