サイトの作成者をjqueryカルーセルに表示しようとしていますが、何らかの理由で画像がli
タグなしで出力され、理由がわかりません。
コード
functions.php
function contributors() {
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name");
foreach($authors as $author) {
// display user image for each author
echo '<li class="author" id="author-'.$author->ID.'">'.userphoto($author->ID).'</li>';
}
}
テンプレートファイル
<?php while ( have_posts() ) : the_post(); ?>
<div id="authorlist"><ul id="authorcarousel"><?php contributors(); ?></ul></div>
<?php endwhile; // end of the loop. ?>
出力
<div id="authorlist">
<ul id="authorcarousel">
<img src="/wordpress/wp-content/uploads/userphoto/1.jpg" alt="admin" width="143" height="150" class="photo" />
<li class="author" id="author-1"></li>
<img src="/wordpress/wp-content/uploads/userphoto/3.png" alt="" width="128" height="128" class="photo" />
<li class="author" id="author-3"></li>
<img src="/wordpress/wp-content/uploads/userphoto/2.png" alt="" width="128" height="128" class="photo" />
<li class="author" id="author-2"></li>
</ul>
</div>
目指しているのは、li
タグ間に出力する画像です。
誰かが答えを知っている場合のボーナス質問 - サイト管理者ではなく作成者のみが表示されるようにクエリを編集するにはどうすればよいですか? クエリに句を追加しようとしましたWHERE
が、うまくいきませんでした。
私はWordPressのn00bであるため、どんな助けも大歓迎です.