-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcateandsort.php
More file actions
executable file
·47 lines (43 loc) · 2.71 KB
/
Copy pathcateandsort.php
File metadata and controls
executable file
·47 lines (43 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
$thiscat = get_category($cat);
$cate = $thiscat ->name;
parse_str($_SERVER['QUERY_STRING'], $get);
$sortType = isset($get['so'])?$get['so']:'';
$orderType = isset($get['o'])?$get['o']:'';
$sortUrl = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].explode("?",$_SERVER["REQUEST_URI"])[0];
?>
<div id="sort" class="layout page padding-top">
<?php if ( wp_is_mobile() ){ ?>
<div class="container mobile">
<div class="content">
<div class="<?php echo $sortType==1||!isset($sortType)||$sortType==''?'active':''?>"><a href="<?php echo $sortUrl.'?so=1'?>">最新</a></div>
<div class="<?php echo $sortType==4?'active':''?>"><a href="<?php echo $sortUrl.'?so=4'?>">销量</a></div>
<div class="<?php echo $sortType==2?'active':''?>"><a href="<?php echo $sortUrl.'?so=2&o=asc'?>">价格</a></div>
<div class="<?php echo $sortType==3&&($orderType=='desc'||!isset($orderType))?'active':''?>"><a href="<?php echo $sortUrl.'?so=3&o=desc'?>">大额优惠券</a></div>
</div>
</div>
<?php }else { ?>
<div class="container">
<div class="ad-sort">
<a href="" target="_blank">
<img src="<?php bloginfo('template_url'); ?>/img/img1.png">
</a>
</div>
<div class="content">
<div>
<a href="javascript:void(0)" id="dropcate"><?php echo $cate;?><span class="arrow"></span></a>
<div class="drop">
<ul class="drop-menu">
<?php wp_nav_menu(array('theme_location'=>'sidebar-menu','walker' => new description_walker() ));?>
</ul>
</div>
</div>
<div class="<?php echo $sortType==1||!isset($sortType)||$sortType==''?'active':''?>"><a href="<?php echo $sortUrl.'?so=1'?>">最新</a></div>
<div class="<?php echo $sortType==4?'active':''?>"><a href="<?php echo $sortUrl.'?so=4'?>">销量高</a></div>
<div class="<?php echo $sortType==2?'active':''?>"><a href="<?php echo $sortUrl.'?so=2&o=asc'?>">价格低</a></div>
<div class="<?php echo $sortType==3&&($orderType=='desc'||!isset($orderType))?'active':''?>"><a href="<?php echo $sortUrl.'?so=3&o=desc'?>">大额优惠券</a></div>
<div class="<?php echo $sortType==3&&$orderType=='asc'?'active':''?>"><a href="<?php echo $sortUrl.'?so=3&o=asc'?>">小额优惠券</a></div>
</div>
</div>
<?php } ?>
</div>