Skip to content

Commit 39fcad1

Browse files
author
Mike Hemberger
committed
1.4.1 added ul_location_posts_query_args filter
1 parent b1f22f3 commit 39fcad1

File tree

4 files changed

+58
-59
lines changed

4 files changed

+58
-59
lines changed

CHANGES.md

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
#### 1.3.3 (10/20/17)
1+
# Changes
2+
3+
## 1.4.1 (2/20/20)
4+
* Added: `ul_location_posts_query_args` filter to change the location blog query.
5+
6+
## 1.3.3 (10/20/17)
27
* Fixed: GA code syntax for Locations.
38

4-
#### 1.3.2 (10/9/17)
9+
## 1.3.2 (10/9/17)
510
* Changed: Display location menu on single location blog posts.
611

7-
#### 1.3.1.1 (9/21/17)
12+
## 1.3.1.1 (9/21/17)
813
* Fixed: Extra spaces before php tag causing issues.
914

10-
#### 1.3.1 (9/21/17)
15+
## 1.3.1 (9/21/17)
1116
* Fixed: Location child pages not showing on frontend.
1217

13-
#### 1.3.0 (9/19/17)
18+
## 1.3.0 (9/19/17)
1419
* Changed: Allow locations to have child (grandchild) pages.
1520
* Changed: Added updater script in plugin so no longer relying on GitHub Updater.
1621

17-
#### 1.2.6.1
22+
## 1.2.6.1
1823
* Update GitHub URI to point to bizbudding account
1924

20-
#### 1.2.6
25+
## 1.2.6
2126
* Update ul_do_location_posts() function to use location_feed taxo instead of location page author to get posts
2227

23-
#### 1.2.5
28+
## 1.2.5
2429
* Add 'publicly_queryable' => true to location_feed taxonomy, so location specific RSS feeds are now viewable via https://example.com/feed/?location_feed=location_641
2530

26-
#### 1.2.4
31+
## 1.2.4
2732
* Add new Location Info tab for 'Options'
2833
* Add new Location Info field for Google Analytics tracking ID
2934
* Display Google Analytics code on all location content/pages
@@ -32,7 +37,7 @@
3237
* Added ul_get_ga_code() display helper function
3338
* Fix flush_rewrite_rules() call upon plugin activation
3439

35-
#### 1.2.3
40+
## 1.2.3
3641
* Remove 'Add Form' button when locations are editing pages
3742
* Allow locations to re-order their pages via Simple Page Ordering plugin
3843
* Add 'ul_contact_details' filter
@@ -41,81 +46,81 @@
4146
* Add 'ul_opening_hours' filter
4247
* Add 'ul_opening_hours_alt' filter
4348

44-
#### 1.2.2.1
49+
## 1.2.2.1
4550
* Hotfix URL word wrap
4651

47-
#### 1.2.2
52+
## 1.2.2
4853
* Fix widget - hours still displaying if closed every day
4954

50-
#### 1.2.1.1
55+
## 1.2.1.1
5156
* Hot fix meta title on location parent page
5257

53-
#### 1.2.1
58+
## 1.2.1
5459
* Fix street issue when showing address
5560
* Add meta and og data to <head>
5661

57-
#### 1.2.0
62+
## 1.2.0
5863
* Rebuild widget, including location info display helper functions
5964
* Breaks existing widget instances
6065

61-
#### 1.1.10.1
66+
## 1.1.10.1
6267
* Hotfix for location author link filter
6368

64-
#### 1.1.10
69+
## 1.1.10
6570
* Fix Locations plural name displaying wrong in breadcrumbs of not logged in
6671
* Filter Yoast breadcrumbs with Location data
6772
* Allow Address Widget to display on blog posts where the post author is a location
6873

69-
#### 1.1.9
74+
## 1.1.9
7075
* Remove Gravity Forms editor form button if logged in as a location
7176

72-
#### 1.1.8
77+
## 1.1.8
7378
* Add support for User Switching plugin
7479
* New User Switching link in Toolbar if user is an admin
7580

76-
#### 1.1.7
81+
## 1.1.7
7782
* Add nav menu support for location_page CPT
7883

79-
#### 1.1.6
84+
## 1.1.6
8085
* location_page CPT has_archive now defaults to true, with a filter to change
8186

82-
#### 1.1.5
87+
## 1.1.5
8388
* Fix load_location_feeds() method failing on some admin pages (FacetWP)
8489

85-
#### 1.1.4
90+
## 1.1.4
8691
* Fix non-location authors being able to see all posts
8792
* Add location fields to Add User form to make it easier when trying to create a user and assign them as a location
8893

89-
#### 1.1.3
94+
## 1.1.3
9095
* Add back location posts to main blog. If a site wants to limit this, it should be on a per site basis
9196

92-
#### 1.1.2
97+
## 1.1.2
9398
* Remove slug metabox if a location user is viewing a parent location page
9499

95-
#### 1.1.1
100+
## 1.1.1
96101
* Add draft and future post status to parent page metabox
97102

98-
#### 1.1.0
103+
## 1.1.0
99104
* Convert location role to custom capabilities
100105
* Location parent pages use core WP edit screen. Remove many acf_form() releated functions
101106
* New ACF location for location_parent_page
102107

103-
#### 1.0.5
108+
## 1.0.5
104109
* Save featured image to main location page
105110
* Add location menu to single posts from locations
106111

107-
#### 1.0.4
112+
## 1.0.4
108113
* More custom experience for managing Publicize via Jetpack
109114

110-
#### 1.0.3
115+
## 1.0.3
111116
* Move Location Settings page/form to a submenu of core Settings
112117
* This allows Publicize to share the same top level menu
113118

114-
#### 1.0.2
119+
## 1.0.2
115120
* Fix widget
116121

117-
#### 1.0.1
122+
## 1.0.1
118123
* Save posts to location_{ID} custom tax term slug
119124

120-
#### 1.0.0
125+
## 1.0.0
121126
* lets do this

composer.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/functions.php

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -157,42 +157,35 @@ function ul_get_location_menu() {
157157
*
158158
* @return mixed
159159
*/
160-
function ul_do_location_posts( $user_id = '' ) {
161-
162-
if ( ! $user_id ) {
163-
164-
// Bail if not a top level location page.
165-
if ( ! ul_is_location_parent_page() ) {
166-
return;
167-
}
168-
169-
// Get the location author.
170-
$user_id = get_the_author_meta( 'ID' );
160+
function ul_do_location_posts() {
171161

162+
// Bail if not a top level location page.
163+
if ( ! ul_is_location_parent_page() ) {
164+
return;
172165
}
173166

174-
// Bail if no user ID.
175-
if ( ! $user_id ) {
167+
// Get the location ID.
168+
$location_id = ul_get_location_id();
169+
170+
// Bail if no location ID..
171+
if ( ! $location_id ) {
176172
return;
177173
}
178174

179175
// Output posts.
180176
echo '<div class="location-template location-posts">';
181177
echo '<h2>' . __( 'Recent Posts', 'user-locations' ) . '</h2>';
182-
$args = array(
183-
'post_type' => 'post',
184-
'author' => $user_id,
185-
);
186178
$args = array(
187179
'post_type' => 'post',
188180
'tax_query' => array(
189181
array(
190182
'taxonomy' => 'location_feed',
191183
'field' => 'slug',
192-
'terms' => sprintf( 'location_%s', ul_get_location_id() ),
184+
'terms' => sprintf( 'location_%s', $location_id ),
193185
),
194186
),
195187
);
188+
$args = apply_filters( 'ul_location_posts_query_args', $args, $location_id );
196189
genesis_custom_loop( wp_parse_args( $args ) );
197190
wp_reset_postdata();
198191
echo '</div>';

user-locations.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* License: GPL-2.0+
1717
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
1818
*
19-
* Version: 1.4.0
19+
* Version: 1.4.1
2020
*
2121
* GitHub Plugin URI: https://github.com/bizbudding/user-locations
2222
* GitHub Branch: master
@@ -175,7 +175,7 @@ private function setup_constants() {
175175

176176
// Plugin version.
177177
if ( ! defined( 'USER_LOCATIONS_VERSION' ) ) {
178-
define( 'USER_LOCATIONS_VERSION', '1.4.0' );
178+
define( 'USER_LOCATIONS_VERSION', '1.4.1' );
179179
}
180180

181181
// Plugin Folder Path.

0 commit comments

Comments
 (0)