php - How to get the url of the entry in which an image belongs

I'm creating a custom attachment template in WordPress, so far so good, but I would like to show the url of the ent

I'm creating a custom attachment template in WordPress, so far so good, but I would like to show the url of the entries or articles where that image belongs

somehow?

<div class="entry-attachment">
                <?php if (wp_attachment_is_image($post->id)) :
                    $att_image = wp_get_attachment_image_src($post->id, "full"); ?>
                    <p class="attachment"><a href="<?php echo wp_get_attachment_url($post->id); ?>" title="<?php the_title(); ?>" rel="attachment"><img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>"  class="attachment-medium" alt="<?php echo $post->post_excerpt; ?>" /></a><figcaption class="captiont">
        <?php echo wp_kses_post(get_post(get_post_thumbnail_id())->post_excerpt); // displays the image caption ?> </figcaption>
                    </p>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744820548a4595588.html

相关推荐

  • php - How to get the url of the entry in which an image belongs

    I'm creating a custom attachment template in WordPress, so far so good, but I would like to show the url of the ent

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信