wordpress - Bootstrap Post Carousel blocking other PHP in page-template -
i have created post carousel within wordpress page-template, other php (such advanced custom fields content , such) blocked. wp_debug shows no errors , can't find error within code.
below code have used create carousel recent posts custom post type:
when entirely remove slider php below work/load, can't seem find mistake in code.
<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 $chunk) { ($chunk === reset($chunks)) ? $active = "active" : $active = ""; $html .= '<div class="item '.$active.'">'; foreach($chunk $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>
you overriding $post
. in wordpress never override $post
try replacing part.
foreach($chunk $slide) { $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', $slide); $html .= '</h6><h2 style="text-align: left;">'; $html .= get_the_title($slide); $html .= '</h2><p style="text-align: left;">'; $html .= get_post_field('post_content', $slide); $html .= '</p></div></div>'; };
not sure if solve rest of problems. might.
, if doesn't @ least code bit cleaner.
edit seeing full script problem.
line 109 if( have_rows('skill-bars')
take wrong $post
broke.
Comments
Post a Comment