0
Wordpress의 디버그 모드에서 문제가 있습니다. 내 기능을 갖춘 슬라이더 점점 오류 Notice: Object of class WP_Query could not be converted to int in on line
Wordpress : Notice : WP_Query 클래스의 객체를 int로 변환 할 수 없습니다.
에서 내가
<div id="<?php slider_class() //Theme function ?>" class="clearfix">
<!--[BEGIN: Slider wrapper]-->
<div id="slides-wrapper" <?php slider_wrapper_class() //Theme function ?>>
<!--[BEGIN: #Slides]-->
<div id="slides" class="<?php slides_class() //Theme function ?> clearfix">
<!--[BEGIN: Slides_container]-->
<div class="slides_container <?php slides_class() //Theme function ?>">
<?php
$featuredPosts = new WP_Query();
$featuredPosts->query('showposts='.get_option('mp_slides_no').'&category_name='.get_option('mp_featured_cat').'');
for($i=1; $i<=$featuredPosts; $i++) { // second for() loop for post slides
while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); // loop for posts
?>
<?php if (get_option('mp_slides_content') === "content_s") { ?>
<!--[BEGIN: ALL SLIDES ++]-->
<div class="slide clearfix">
<!-- thumbnail start -->
<?php mp_thumb('featured-thumbnail','featured-slider-thumbnail','480'); //Theme function ?>
<!-- end of thumbnail -->
<div class="featured-excerpt">
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php echo substr($post->post_title,0,50); // short title ?>...</a></h2>
<?php the_excerpt(); ?>
<br />
<a href="<?php the_permalink(); ?>" class="featured-readmore clearfix"><span>Read more</span><img src="<?php bloginfo('template_directory'); ?>/images/button-arrow.png" alt="readmore" width="24" height="24" /></a>
</div>
</div>
<!--[END: ALL SLIDES ++]-->
<?php } elseif (get_option('mp_slides_content') === "image_s") { ?>
<!--[image slider start]-->
<!--[BEGIN: ALL SLIDES ++]-->
<div class="slide clearfix">
<!-- thumbnail start -->
<?php if (get_option('mp_slides_style') === "fixed") { ?>
<?php mp_thumb('featured-thumbnail','featured-slider-image920','920'); //Theme function ?>
<?php } else { ?>
<?php mp_thumb('featured-thumbnail','featured-slider-image960','960'); //Theme function ?>
<?php } ?>
<!-- end of thumbnail -->
</div>
<!--[END: ALL SLIDES ++]-->
<!--[end of image slider]-->
<?php } ?>
<?php endwhile;
} // end for() loop number 2
?>
</div>
<!--[END: Slides_container]-->
<a href="#" class="prev"></a>
<a href="#" class="next"></a>
</div>
<!--[END: #Slides]-->
</div>
<!--[END: Slider wrapper]-->
</div>
//theme function
당신은 for 루프를 제거해야 스타일
아니요 아무 것도 바뀌지 않습니다. for 루프가 문제를 만들 수 있습니까? –
for ($ i = 1; $ i <= $ featuredPosts; $ i ++)'<--- 이것을 할 수 있습니까? featuredPosts는 숫자가 아닙니다. 그 루프를 제거하고 그 문제가 해결되는지 확인합니다. –
답장을 늦게해서 죄송합니다. Brain Garson. 문제를 해결했습니다. 당신 말이 맞아요 ... 나는 동시에 두 개의 루프를 사용하여 그것을 모르고 있었고 그 오류가 발생했습니다. 나는 루프를 제거하고 완료했습니다 ... 덕분에 많이 –