一直在尝试一段时间来解决这个问题,但我没有看到问题出在哪里。WordPress外观 - 找不到其他工作
这是我的代码
<?php
//get all post IDs for posts start with letter A, in title order,
//display posts
global $wpdb;
$char_k = 'A';
$postids = $wpdb->get_col($wpdb->prepare("
SELECT ID
FROM $wpdb->posts
WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s
ORDER BY $wpdb->posts.post_title",$char_a));
if ($postids) {
$args=array(
'post__in' => $postids,
'post_type' => 'encyklopedi',
'post_status' => 'publish',
'posts_per_page' => -1,
// 'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if($my_query->have_posts()) {
// echo 'List of Posts Titles beginning with the letter '. $char_a;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php endwhile; }
wp_reset_query(); } ?>
这就是我试图在代码
<?php } endwhile; else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
年底改变 我也试图改变这一
<?php endwhile; } else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
我不断收到此错误消息
Parse error: syntax error, unexpected 'else' (T_ELSE)
我怎样才能解决这个问题?
谢谢你这么多@rickdenhaan –