我正在使用PhotoSmash 该插件允许用户上传自己的图片并对其进行投票,效果非常好。在我的一个页面上,我使用以下代码列出了具有特定类别的帖子:
<?php
if (is_page() ) {
$category = get_post_meta($posts[0]->ID, \'category\', true);
}
if ($category) {
$cat = get_cat_ID($category);
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$post_per_page = -1; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
\'category__in\' => array($cat),
\'orderby\' => \'date\',
\'order\' => \'ASC\',
\'paged\' => $paged,
\'posts_per_page\' => $post_per_page,
\'caller_get_posts\' => $do_not_show_stickies
);
$temp = $wp_query; // assign orginal query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query($args);
if( have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<section class="vote6" id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
<section class="voter">
<?php DisplayVotes(get_the_ID()); ?>
</section>
</section>
<?php endwhile; ?>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn\'t here.</p>
<?php get_search_form(); ?>
<?php endif;
$wp_query = $temp; //reset back to original query
} // if ($category)
?>
这也很好,除非Photomash插件被激活。我得到以下错误:
致命错误:在nas-001\\winspace004\\10-3mpromos中的非对象上调用成员函数get()。ca\\www\\carcrazy\\wp includes\\query。php在线27
第27行是return $wp_query->get($var);
这个问题在bwb photosmash中的某个地方。php在插件的主文件夹中,但我不知道在哪里。还有其他人遇到过这个问题吗?