一直在嘗試一段時間來解決這個問題,但我沒有看到問題出在哪裏。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 –