http://blog.anekipedia.com/cus/%E8%A8%98%E4%BA%8B%E4%B8%80%E8%A6%A7%E3%82%92%E3%82%BD%E3%83%BC%E3%83%88%EF%BC%88%E4%B8%A6%E3%81%B3%E6%9B%BF%E3%81%88%EF%BC%89%E3%81%99%E3%82%8B.html
参考url
<form name="irekae" method="get" id="form" class="form">
<select name='narabi' onChange="document.forms['irekae'].submit()" >
<option value="sort1"<?php if(!isset($_REQUEST['narabi']) || $_REQUEST['narabi'] == 'sort1') echo ' selected="selected"';?>>新しい順</option>
<option value="sort2"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort2') echo ' selected="selected"';?>>古い順</option>
<option value="sort3"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort3') echo ' selected="selected"';?>>五十音昇順</option>
<option value="sort4"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort4') echo ' selected="selected"';?>>五十音降順</option>
<option value="sort5"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort5') echo ' selected="selected"';?>>アクセス数の多い順</option>
<option value="sort6"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort6') echo ' selected="selected"';?>>アクセス数の少ない順</option>
</select>
</form>
<?php $sortset = $_GET['narabi']; ?>
<?php $sortall = array(
"sort1" => 'order=DESC&posts_per_page=6&paged=',
"sort2" => 'order=ASC&posts_per_page=6&paged=',
"sort3" => 'order=ASC&orderby=meta_value&meta_key=furikana&posts_per_page=6&paged=',
"sort4" => 'order=DESC&orderby=meta_value&meta_key=furikana&posts_per_page=6&paged=',
"sort5" => 'order=DESC&orderby=meta_value_num&meta_key=views&posts_per_page=6&paged=',
"sort6" => 'order=ASC&orderby=meta_value_num&meta_key=views&posts_per_page=6&paged='
); ?>
<?php if($sortset != '') {
$sort = $sortall[$sortset];
} else {
$sort = $sortall["sort1"];} ?>
<!-- <?php echo $sort; ?> -->
<?php query_posts($sort . $paged); ?>
参考url
<form name="irekae" method="get" id="form" class="form">
<select name='narabi' onChange="document.forms['irekae'].submit()" >
<option value="sort1"<?php if(!isset($_REQUEST['narabi']) || $_REQUEST['narabi'] == 'sort1') echo ' selected="selected"';?>>新しい順</option>
<option value="sort2"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort2') echo ' selected="selected"';?>>古い順</option>
<option value="sort3"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort3') echo ' selected="selected"';?>>五十音昇順</option>
<option value="sort4"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort4') echo ' selected="selected"';?>>五十音降順</option>
<option value="sort5"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort5') echo ' selected="selected"';?>>アクセス数の多い順</option>
<option value="sort6"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort6') echo ' selected="selected"';?>>アクセス数の少ない順</option>
</select>
</form>
<?php $sortset = $_GET['narabi']; ?>
<?php $sortall = array(
"sort1" => 'order=DESC&posts_per_page=6&paged=',
"sort2" => 'order=ASC&posts_per_page=6&paged=',
"sort3" => 'order=ASC&orderby=meta_value&meta_key=furikana&posts_per_page=6&paged=',
"sort4" => 'order=DESC&orderby=meta_value&meta_key=furikana&posts_per_page=6&paged=',
"sort5" => 'order=DESC&orderby=meta_value_num&meta_key=views&posts_per_page=6&paged=',
"sort6" => 'order=ASC&orderby=meta_value_num&meta_key=views&posts_per_page=6&paged='
); ?>
<?php if($sortset != '') {
$sort = $sortall[$sortset];
} else {
$sort = $sortall["sort1"];} ?>
<!-- <?php echo $sort; ?> -->
<?php query_posts($sort . $paged); ?>