强制php读入Wordpress中的嵌入iframe字段

时间:2015-04-14 15:00:08

标签: php wordpress iframe shortcode

在我的旧Wordpress主题中,我有一项特殊功能,允许在Portofolio帖子的右侧插入带有iFrame的YouTube视频。 但是现在我要为这个地方(每个投资组合的帖子)插入一个简单的短代码(每个投资组合帖子不同),用于这样的[disk_player id="2513"]网络音频播放器。

此代码无法读取,只能作为简单的文本行。此外,无法读取短代码的等效php代码(例如<?php echo do_shortcode('[disk_player id="2513"]'); ?>

我还尝试在代码前后添加[raw] ... [/raw]代码,但它不起作用。

你能帮我强行读一下这个字段中的短代码吗?

非常感谢大家。 P

1 个答案:

答案 0 :(得分:0)

这是右栏的代码:

    <li id="right-column">
            <div class="gallery-slider clearfix">

                <?php if(obox_has_video($post->ID)):
                    $args  = array('postid' => $post->ID, 'width' => 660, 'height' => 660, 'hide_href' => true, 'exclude_video' => false, 'imglink' => false, 'wrap' => 'div', 'wrap_class' => 'post-image fitvid');
                    $image = get_obox_media($args);
                    echo $image;
                else : ?>
                    <ul class="gallery-container">
                        <?php $attach_args = array("post_type" => "attachment", "post_parent" => $post->ID, "numberposts" => "-1", "orderby" => "menu_order", "order" => "ASC");
                        $attachments = get_posts($attach_args);
                        foreach($attachments as $attachement => $this_attachment) :  
                            $image = wp_get_attachment_image_src($this_attachment->ID, "660auto");
                            $full = wp_get_attachment_image_src($this_attachment->ID,  "full"); ?>
                            <li>
                                <a href="<?php echo $full[0]; ?>" rel="lightbox">
                                    <img src="<?php echo $image[0]; ?>" alt="<?php echo $this_attachment->post_title; ?>" />
                                </a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                    <?php if(count($attachments) > 1) : ?>
                        <div class="controls"> 
                            <a href="#" class="next"><?php _e("Next", "ocmx") ?></a> 
                            <a href="#" class="previous"><?php _e("Previous", "ocmx") ?></a>
                        </div> 
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </li>

主题是第一个版本:http://demo.oboxsites.com/retail-therapy/(与我的完全不同)。

谢谢