有点菜鸟,我一直在网上搜索没有线索。我试图按字母顺序整理这个自定义帖子(在我的情况下为滑块),你可以看到我已经添加了命令进行排序但它只是忽略它并继续显示随机循环。我错过了什么?
谢谢!
<?php
/*
Template Name: Fullscreen Slideshow
*/
get_header();
$slide_loop = new WP_Query( array('post_type' => THEME_SLIDE_TYPE, 'posts_per_page' => -1, 'post__in' => 0, 'orderby' => 'title', 'order' => 'ASC' ) );
?>
<div id="fullscreenSlideshow">
<?php if ($slide_loop->have_posts()) : while ($slide_loop->have_posts()) : $slide_loop->the_post(); ?>
<?php
$slide_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
$slide_text_position = (get_post_meta($post->ID, THEME_METABOX . "slide_text_position", true) == "") ? "left" : get_post_meta($post->ID, THEME_METABOX . "slide_text_position", true);
$slide_color = (get_post_meta($post->ID, THEME_METABOX . "slide_color", true) == "") ? "light" : get_post_meta($post->ID, THEME_METABOX . "slide_color", true);
?>
<div class="slide">
<img src="<?php echo $slide_image_url[0];?>" />
<div class="overlay"></div>
<div class="content <?php echo $slide_text_position; ?> <?php echo $slide_color; ?>">
<h1><?php the_title(); ?></h1>
<div class="caption"><?php the_content(); ?></div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div id="slideshowNav">
<div id="slideCount">
</div>
<div id="slideControls">
<a id="slideprev" href="javascript:;"><?php _e("Prev", "ablaze");?></a>
<a id="slidenext" href="javascript:;"><?php _e("Next", "ablaze");?></a>
</div>
</div>
<?php get_footer();
答案 0 :(得分:0)
您应该从参数中删除post__in
。另请参阅WP_Query
只需注意,不要在函数名称,自定义帖子类型名称和分类名称中使用大写字母。他们很麻烦。另外,不要在名称的开头使用数字,也不要使用任何特殊字符(下划线_
除外)