代码适用于HTML页面,但不适用于Wordpress帖子

时间:2012-04-08 19:45:04

标签: javascript html css wordpress

首先,这是我正在使用的代码。

<div class="wrapper">
<div id="carousel">
<ul>
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/umbrella_trials.jpg" alt="" /><a class="video" title="The Umbrella Trails" href="http://www.youtube.com/v/eiBEvtNNSxg?fs=1&amp;autoplay=1">The Umbrella Trails</a></li>
</ul>
</ul>
&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/stagnant_day.jpg" alt="" /><a class="video" title="Stagnant Day" href="http://www.youtube.com/v/x3r5vblNAtw?fs=1&amp;autoplay=1">Stagnant Day</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/job3a_trailer2.jpg" alt="" /><a class="video" title="Job3(a) Trailer #2" href="http://www.youtube.com/v/setjOKfzNHY?fs=1&amp;autoplay=1">Job3(a) Trailer #2</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/job3a_trailer3.jpg" alt="" /><a class="video" title="Job3(a) Trailer #3" href="http://www.youtube.com/v/ijkEfmMNr5Q?fs=1&amp;autoplay=1">Job3(a) Trailer #3</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/TNaTFiTC.jpg" alt="" /><a class="video" title="Fables from the Mersey - 'The Ninja and The Fella in the Cellar'" href="http://www.youtube.com/v/OdFCo1MmgTI?fs=1&amp;autoplay=1">"The Ninja and The Fella in the Cellar"</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/job3a_trailer1.jpg" alt="" /><a class="video" title="Job3(a) Trailer #1" href="http://www.youtube.com/v/3pQUX6VkPTQ?fs=1&amp;autoplay=1">"Job3(a) Trailer #1"</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/opening_credits.jpg" alt="" /><a class="video" title="Opening Credits for &quot;It's Liverpool&quot;" href="http://www.youtube.com/v/6a19T8syH60?fs=1&amp;autoplay=1">"Opening Credits for "It's Liverpool""</a></li>
</ul>
&nbsp;

&nbsp;
<ul>
    <li><img src="<?php bloginfo('template_directory'); ?>/images/1-24.jpg" alt="" /><a class="video" title="It's Liverpool 1-24" href="http://www.youtube.com/v/7r9N-dq1KEE?fs=1&amp;autoplay=1">"It's Liverpool 1-24"</a></li>
</ul>
&nbsp;

&nbsp;
<div class="clearfix"></div>
<a id="prev" class="prev" href="#">&lt;</a>
<a id="next" class="next" href="#">&gt;</a>
<div id="pager" class="pager"></div>
</div>
</div>
<div id="line1"></div>
<div class="paraWrapper">
<div class="span3">
<h2 class="heading">Heading</h2>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

<a class="btn" href="#">View details »</a>

</div>
<div class="span3">
<h2 class="heading">Heading</h2>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

<a class="btn" href="#">View details »</a>

</div>
<div class="social_icons span2"><a class="btn" href="#">
<em class="icon-twitter-sign icon-large"></em> Follow us on Twitter</a><a class="btn" href="#">
<em class="icon-facebook-sign icon-large"></em> Find us on Facebook</a>

<a class="btn" href="#">
<em class="icon-facetime-video icon-large"></em> Subscribe on Youtube</a>

</div>
</div>
<div id="line2"></div>

如果我将其粘贴到一个简单的HTML页面(取出特定的php代码),它可以正常工作(连同所需的Javascripts)。

如果我将它粘贴到Wordpress主题中,我试图从它构建。它不会工作..

我甚至尝试将代码直接粘贴到我的page.php文件中,虽然它确实有效。这不是我想要的,因为它需要轻松访问它的内容。

I'wordpresve尝试安装Raw-HTML插件,但没有区别。

我正在使用Wordpress的最新版本(3.3.1)

2 个答案:

答案 0 :(得分:1)

您在代码中使用php。为了安全起见,Wordpress必须通过删除php来清理你的帖子。我不认为你可以把PHP放在你的帖子中。你需要修改你的wordpress以支持帖子中的php,但这不容易

答案 1 :(得分:0)

您可以使用Shortcode来切换一个将绝对/路径/写入模板文件夹的短代码吗?