简体   繁体   English

在Wordpress帖子中获取附件ID

[英]Get attachment id in a Wordpress post

I am designing a wallpaper website. 我正在设计一个墙纸网站。 In every post there is only one unique image which I'm trying to get the attachment ID associated with that image. 在每个帖子中,只有一个唯一的图像,我正在尝试获取与该图像关联的附件ID。

My code that gets the post's content: 我得到帖子内容的代码:

<?php the_content( __( 'Continue Reading' , 'nuntius' ) . ' &raquo;'); ?>

I can get the thumbnail image's link, but not the full image's link. 我可以获取缩略图的链接,但不能获取完整图像的链接。

Is there anyway to do this? 反正有这样做吗?

the <?php the_post_thumbnail( 'full' ); ?> <?php the_post_thumbnail( 'full' ); ?> <?php the_post_thumbnail( 'full' ); ?> returns the full thumbnail image. <?php the_post_thumbnail( 'full' ); ?>返回完整的缩略图。

If you want the image url then you can use <?php the_post_thumbnail_url( 'full' ); ?> 如果您想要图片网址,则可以使用<?php the_post_thumbnail_url( 'full' ); ?> <?php the_post_thumbnail_url( 'full' ); ?> Let me know if this helps or not. <?php the_post_thumbnail_url( 'full' ); ?>让我知道,如果这有助于与否。

https://codex.wordpress.org/Function_Reference/get_post_thumbnail_id我认为这对您有帮助可能描述了您想要什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM