我在WordPress页面模板中创建了一个传送轮播,但所有其他PHP(例如高级自定义字段内容等)都被阻止。 wp_debug显示没有错误,我在代码中找不到任何错误。Bootstrap Post传送带阻止页面模板中的其他PHP
下面是我用来创建与自定义类型后最近的职位转盘代码:
当我完全删除滑块下的所有工作PHP /负载,但我似乎并不能在代码中发现错误。
<div class="carousel-inner" role="listbox">
<?php
$i = 2;
global $post;
$args = array(
'numberposts' => -1,
'post_type' => 'work',
'orderby' => 'date',
'order' => 'ASC',
);
$myposts = get_posts($args);
if($myposts):
$chunks = array_chunk($myposts, $i);
$html = "";
foreach($chunks as $chunk) {
($chunk === reset($chunks)) ? $active = "active" : $active = "";
$html .= '<div class="item '.$active.'">';
foreach($chunk as $post) {
$html .= '<div id="timeline-item" class="col-lg-6 col-md-6 col-sm-6 col-xs-6"><div><h6 style="text-align: left;">';
$html .= get_the_date('Y');
$html .= '</h6><h2 style="text-align: left;">';
$html .= get_the_title();
$html .= '</h2><p style="text-align: left;">';
$html .= get_post_field('post_content');
$html .= '</p></div></div>';
};
$html .= '</div>';
};
echo $html;
endif;
?>
</div>
你是什么意思'所有其他的PHP'被阻止?你的error_log里有什么吗? – delboy1978uk
例如<?php the_field('stalk-me'); ?>应显示您可以在后端添加的内容,但是它根本不显示任何内容。当我删除整个滑块时,会显示内容。 – imrafaelhi
嗯。你有完整的脚本吗? – delboy1978uk