Wordpress 显示主题图片的实现代码

前端之家收集整理的这篇文章主要介绍了Wordpress 显示主题图片的实现代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="msgborder" id="PHPcode15"> @H_502_0@ $id,'post_type' => 'attachment','post_mime_type' => 'image','numberposts' => 1)); reset($children); $childID = key($children); //$childURL = wp_get_attachment_url($childID); $childArray = wp_get_attachment_image_src($childID,false); $childURL = $childArray['0']; if(empty($childURL)){ $childURL = get_bloginfo('template_url')."/images/default.png"; } } return($childURL); } //Run this in the loop (or any place you'd like - as long as you have an ID to Feed it..) //First argument is the ID.. //Second argument is the size.. It'll handle 'large','medium','thumbnail' or even 'array(100,100)'.. get_primary_image(get_the_ID(),'large'); ?>

原文链接:https://www.f2er.com/wordpress/15460.html

猜你在找的wordpress相关文章