Wordpress按字母顺序对自定义字段值进行排序
我正在使用WordPress自定义内容类型管理器建立一个文学机构网站 我停留的页面是作者页面,它显示了所有与作者相关的书籍的缩略图。我下面的代码就是这样做的,但是我希望它按字母顺序显示。代码如下:Wordpress按字母顺序对自定义字段值进行排序,wordpress,sorting,custom-fields,alphabetical,Wordpress,Sorting,Custom Fields,Alphabetical,我正在使用WordPress自定义内容类型管理器建立一个文学机构网站 我停留的页面是作者页面,它显示了所有与作者相关的书籍的缩略图。我下面的代码就是这样做的,但是我希望它按字母顺序显示。代码如下: <?php if (get_custom_field("authimage:get_post")):?> <div class="thumbstrip"> <h4>Titles by this Author</h4> <ul> <?ph
<?php if (get_custom_field("authimage:get_post")):?>
<div class="thumbstrip">
<h4>Titles by this Author</h4>
<ul>
<?php $my_post = get_custom_field("authimage:get_post");
if(!empty($my_post)){
foreach ($my_post as $a) {
print '<li><a href="'. $a['permalink'] .'" title="'. $a['post_title'] .'"><img src="'.$a ['thumbnail_src'].'" /></a></li>';
}
}
?>
<ul>
</div>
<?php endif;?>
作者的标题
我到处都搜索过,但很难将解决方案应用到我现有的代码中。
<?php
$args=array(
'meta_key' => 'authimage',
'orderby' => 'meta_value',
'order' => 'ASC',
'numberposts' => 99
);
$thePosts = get_posts($args);
$i=1;
foreach($thePosts as $thisPost){
$getPost = get_post($thisPost->ID);
//Whatever you want to do with the post
}
?>
由于某种原因,显示缩略图的部分变为空白。我对这个有点陌生。我需要知道如何将任何解决方案合并到现有代码中。如果你能给我看我的代码,那就太好了。谢谢