自定义帖子类型的Wordpress附件插件

问题描述 投票:0回答:1

我正在尝试获取自定义帖子类型的附件插件,但由于附件已更新,我无法让它显示。

define( 'ATTACHMENTS_LEGACY', true ); // force the legacy version of Attachments

我已经定义LEGACY使用旧版本的附件(我知道它确实在版本1中有效),但它现在只显示Post和Page类型,而不是我的自定义帖子类型'Property'。

这是我在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 => array(

T_DOUBLE_ARROW上的语法错误。

任何帮助将不胜感激,因为我说它在附件更新之前有效。

这是有问题的网站 - http://www.james-hayward.com/property/gloucester-road/(通常附件出现在任何属性页面的右侧)。

php wordpress wordpress-plugin
1个回答
1
投票

define('ATTACHMENTS_LEGACY',true); //强制使用旧版本的附件

在配置文件的顶部而不是底部,它工作。

© www.soinside.com 2019 - 2024. All rights reserved.