我正在尝试获取自定义帖子类型的附件插件,但由于附件已更新,我无法显示它。
define( 'ATTACHMENTS_LEGACY', true ); // force the legacy version of Attachments
我已将 LEGACY 定义为使用旧版本的附件(我确信它在版本 1 中有效),但它现在只显示帖子和页面类型,而不是我的自定义帖子类型“属性”。
这是我在 single-property.php 中的代码
<?php
if( function_exists( 'attachments_get_attachments' ) ){
$attachments = attachments_get_attachments();
$total_attachments = count( $attachments );
if( $total_attachments ) :
for( $i=0; $i<$total_attachments; $i++ ) : ?>
<img src="<?php echo $attachments[$i]['location']; ?>" title="<?php echo $attachments[$i]['title']; ?>" />
<?php endfor; ?>
<?php endif; ?>
<?php } ?>
我也试过在这里创建一个自定义实例 - http://wordpress.org/extend/plugins/attachments/other_notes/但我在这一行遇到语法错误:
$fields => 数组(
T_DOUBLE_ARROW 上的语法错误。
任何帮助将不胜感激,正如我所说,它在附件更新之前有效。
这是有问题的网站 - http://www.james-hayward.com/property/gloucester-road/(通常附件出现在任何属性页面的右侧)。