Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP显示一个ACF帖子,该帖子与其同级帖子具有不同的字段_Php_Wordpress_Custom Post Type - Fatal编程技术网

PHP显示一个ACF帖子,该帖子与其同级帖子具有不同的字段

PHP显示一个ACF帖子,该帖子与其同级帖子具有不同的字段,php,wordpress,custom-post-type,Php,Wordpress,Custom Post Type,我有5个画廊是使用高级自定义字段中的自定义帖子类型创建的。我的一个库与其他库具有不同的字段集。原因是我需要显示一个图像并描述该图像,然后重复几个图像。我使用了一个Repeater字段来为每个图像执行此操作 显示“我的其他图库”的代码仅具有所见即所得和图库字段,如下所示: if ( have_posts() ) while ( have_posts() ) : the_post(); echo get_the_title(); echo get_the_conte

我有5个画廊是使用高级自定义字段中的自定义帖子类型创建的。我的一个库与其他库具有不同的字段集。原因是我需要显示一个图像并描述该图像,然后重复几个图像。我使用了一个Repeater字段来为每个图像执行此操作

显示“我的其他图库”的代码仅具有所见即所得和图库字段,如下所示:

    if ( have_posts() ) while ( have_posts() ) : the_post(); 
      echo get_the_title();
      echo get_the_content(); 

      //Display images from Gallery Field
      $images = get_field('gallery_images');
          if( $images ): 
              foreach( $images as $image ): 
                  echo $image['url']; 
              endforeach; 
          endif;
我如何根据我的特别图库的单个帖子名或slug(即相册)显示该图库的字段

“我的转发器”字段称为“唱片集信息”,其子字段为“唱片集标题”、“唱片集图像”和“唱片集描述”

非常感谢您的帮助:

就你而言:

if( have_rows('album_information') ) {
    while ( have_rows('album_information') ) {
        the_row();
        the_sub_field('album_title');
        the_sub_field('album_image');
        the_sub_field('album_description');
    }
}

非常感谢您的回复。正如你回答的那样,我已经明白了这一点。我事先还需要以下内容:$args=array'post\u type'=>'post\u type\u gallery','p'=>'1748',//post的id$_查询=新的WP_查询$args;