WordPress代码笔记

技术流评论2,457阅读模式

wordpress获取某个特定页面的链接:文章源自原紫番博客-https://www.yuanzifan.com/54528.html

get_page_link(58);

括号中填写的是这个页面的Pageid。文章源自原紫番博客-https://www.yuanzifan.com/54528.html

获取缩略图地址文章源自原紫番博客-https://www.yuanzifan.com/54528.html

    <?php  $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); ?>
                   
<img src="<?php echo $full_image_url[0];?>" alt="">

最末尾的参数full,代表获取完整图片,也可以改为small.large等参数。即使用小的或大的特色图片文章源自原紫番博客-https://www.yuanzifan.com/54528.html 文章源自原紫番博客-https://www.yuanzifan.com/54528.html

 

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证