Custom wordpress pages 如何在wordpress中的single.php文件上显示附加图像

Custom wordpress pages 如何在wordpress中的single.php文件上显示附加图像,custom-wordpress-pages,Custom Wordpress Pages,也许有人解决了这个问题对不起,如果我再问这个问题。我有一篇文章显示在头版现在这篇文章有一个功能图像连同其他图像和画廊 当用户单击post时,我想要的是,它将在single.php上显示完整的post视图。我想在这个single.php视图上显示一个图像和一些文本以及一个自定义的图库图像,但不显示功能图像 我写了一段代码,但它不起作用 function displayPostImages() { global $post; function $attachments = get_childr

也许有人解决了这个问题对不起,如果我再问这个问题。我有一篇文章显示在头版现在这篇文章有一个功能图像连同其他图像和画廊

当用户单击post时,我想要的是,它将在single.php上显示完整的post视图。我想在这个single.php视图上显示一个图像和一些文本以及一个自定义的图库图像,但不显示功能图像

我写了一段代码,但它不起作用

function displayPostImages() { 

global $post; function

$attachments = get_children(array('post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'post_mime_type' => 'image' ));



$image =  get_post_thumbnail_id( $post->ID); // featured_image ID
$featured_image = wp_get_attachment_image_src($image);

if ($attachments) { // if there are images attached to posting, start the flexslider markup
    foreach ( $attachments as $attachment_id => $attachment ) { 

    if($attachment->ID != $image && $featured_image ){

    $img_source = wp_get_attachment_image_src( $attachment_id, 'full' )[0];

    //print_r($img_source);
?>

// here will be HTML to display TOP images text and gallery images.





<?php
             }
         }
     }
 }
displayPostImages();
?>
函数displayPostImages(){
全球$post;功能
$attachments=get_children(数组('post_parent'=>$post->ID,'order'=>'ASC','orderby'=>'菜单顺序','post_type'=>'附件','post_mime_type'=>'image');
$image=get_post_缩略图_id($post->id);//特色_图像id
$featured\u image=wp\u get\u attachment\u image\u src($image);
如果($attachments){//如果有附加到发布的图像,则启动flexslider标记
foreach($attachments as$attachment_id=>$attachment){
如果($attachment->ID!=$image&&$profected\u image){
$img_source=wp_get_attachment_image_src($attachment_id,'full')[0];
//打印(图片来源);
?>
//这里将是HTML显示顶部图像文本和画廊图像。

函数返回了什么? 我看不到“return”或“echo$someresult”


此数组是否为空$attachments=get_children….

请参阅此处是工作模板示例感谢Breakermind。我尝试了该脚本,但它没有完成我要查找的任务。再次拉取特色图像和库脚本时出错。