-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-fossils-list.php
107 lines (83 loc) · 3.32 KB
/
content-fossils-list.php
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
use myFOSSIL\Plugin\Specimen\Fossil;
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$fossil_search_query = array_key_exists("fossil_search", $_REQUEST)
&& $_REQUEST["fossil_search"] ? $_REQUEST["fossil_search"] : null;
$wp_query_args = array(
'post_type' => Fossil::POST_TYPE,
'posts_per_page' => $fossil_search_query ? -1 : 10,
'paged' => $paged,
);
if ( bp_displayed_user_id() ) {
$wp_query_args['author'] = bp_displayed_user_id();
if ( bp_displayed_user_id() == bp_loggedin_user_id() )
$wp_query_args['post_status'] = 'any';
}
$fossils = new WP_Query( $wp_query_args );
?>
<?php if ( ! bp_displayed_user_id() ): ?>
<div id="buddypress-header">
<div id="item-header" role="complementary" class="container">
<div class="row" id="groups-header">
<div id="item-header-content" class="col-md-9">
<h1>Fossils</h1>
<?php do_action( 'template_notices' ); ?>
</div><!-- #item-header-content -->
<div class="col-sm-12 col-md-3">
<?php myfossil_fossil_create_button() ?>
</div>
</div>
</div>
<div id="item-nav" class="container">
<div class="item-list-tabs" role="navigation">
<ul class="nav nav-tabs">
<li class="selected current active">
<a>
<?php printf( __( 'All Fossils', 'buddypress' ) ); ?>
</a>
</li>
</ul>
</div><!-- .item-list-tabs -->
</div>
</div>
<?php endif; ?>
<?php if ( ! bp_displayed_user_id() ): ?>
<div id="buddypress" class="container page-styling no-border-top">
<?php endif; ?>
<div class="row" style="margin-bottom: 10px">
<div class="col-sm-12 col-md-6 col-md-offset-6 text-right">
<form action="" method="get" class="form-inline">
<div class="form-group">
<label class="sr-only" for="fossils_search">Search Fossils</label>
<input
type="text"
name="fossil_search"
id="fossils_search"
class="form-control input-sm"
value="<?=$fossil_search_query ?>"
placeholder="By name, species, etc."
/>
</div>
<button type="submit" class="btn btn-primary btn-search" ><span class="fa-stack">
<i class="fa fa-search fa-stack-1x fa-inverse"></i>
</span>Search fossils</button>
</form>
</div>
</div>
<main id="main" class="site-main" role="main">
<?php myfossil_list_fossils_table( $fossils, $fossil_search_query ); ?>
<div class="row-centered">
<?=myfossil_paginate_links( $fossils ) ?>
</div>
</main><!-- #main -->
<?php if ( ! bp_displayed_user_id() ): ?>
</div><!-- #primary -->
<?php endif; ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
if (window.location.search.indexOf('mfs=1') > -1)
jQuery('#fossils_search').focus();
});
</script>
<?php
wp_reset_query();