Pods – Custom Content Types and Fields - Version 2.7.26

Version Description

  • January 8th, 2021 =

  • Fixed: Prevent PHP warnings in the components/Templates/includes/element-pod_reference.php file. #5914 (@JoryHogeveen)

  • Added: New filter pods_shortcode_detect_from_current_post allows you to override whether a shortcode should detect the post object outside of the loop (default is only when in_the_loop()). This helps to fix problems that are part of the integration which the free Pods Beaver Themer Add-On uses. (@sc0ttkclark)

Download this release

Release Info

Developer sc0ttkclark
Plugin Icon 128x128 Pods – Custom Content Types and Fields
Version 2.7.26
Comparing to
See all releases

Code changes from version 2.7.25 to 2.7.26

components/Templates/includes/element-pod_reference.php CHANGED
@@ -1,18 +1,21 @@
1
  <div class="pod-queries-tools"><?php
2
 
3
- if ( empty( $atts ) ) {
4
- $atts = array(
5
  'pod' => '',
6
  );
7
- }
 
 
 
 
8
 
9
  $api = pods_api();
10
  $_pods = $api->load_pods();
11
  echo '<select name="pod_reference[pod]" id="pod-reference" class="pod-switch" data-template="#podref-tmpl" data-target="#pod-reference-wrapper" data-action="pq_loadpod" data-event="change" />';
12
  echo '<option value="">' . __( 'Select Pod to use as reference', 'pods' ) . '</option>';
13
- foreach ( $_pods as $pod ) {
14
- echo '<option value="' . esc_attr( $pod['name'] ) . '" ' . ( $atts['pod'] == $pod['name'] ? 'selected="selected"' : '' ) . '>' . esc_html( $pod['label'] ) . '</option>';
15
- }
16
  echo '</select>';
17
  ?></div>
18
  <div id="pod-reference-wrapper" class="pod-reference-wrapper">
@@ -27,8 +30,6 @@ foreach ( $_pods as $pod ) {
27
  echo '</div>';
28
  }
29
  }
30
- } else {
31
-
32
  }
33
 
34
  ?>
1
  <div class="pod-queries-tools"><?php
2
 
3
+ $defaults = array(
 
4
  'pod' => '',
5
  );
6
+ if ( empty( $atts ) ) {
7
+ $atts = $defaults;
8
+ } else {
9
+ $atts = wp_parse_args( $atts, $defaults );
10
+ }
11
 
12
  $api = pods_api();
13
  $_pods = $api->load_pods();
14
  echo '<select name="pod_reference[pod]" id="pod-reference" class="pod-switch" data-template="#podref-tmpl" data-target="#pod-reference-wrapper" data-action="pq_loadpod" data-event="change" />';
15
  echo '<option value="">' . __( 'Select Pod to use as reference', 'pods' ) . '</option>';
16
+ foreach ( $_pods as $pod ) {
17
+ echo '<option value="' . esc_attr( $pod['name'] ) . '" ' . ( $atts['pod'] == $pod['name'] ? 'selected="selected"' : '' ) . '>' . esc_html( $pod['label'] ) . '</option>';
18
+ }
19
  echo '</select>';
20
  ?></div>
21
  <div id="pod-reference-wrapper" class="pod-reference-wrapper">
30
  echo '</div>';
31
  }
32
  }
 
 
33
  }
34
 
35
  ?>
includes/general.php CHANGED
@@ -882,9 +882,18 @@ function pods_shortcode_run( $tags, $content = null ) {
882
 
883
  // Only allow revert to current object if there are no query tags.
884
  if ( ! $has_query_tags ) {
 
 
 
 
 
 
 
 
 
885
 
886
  // Archives, Post type archives, singular posts.
887
- if ( in_the_loop() ) {
888
  $pod = pods( get_post_type(), get_the_ID(), false );
889
 
890
  if ( ! empty( $pod ) ) {
882
 
883
  // Only allow revert to current object if there are no query tags.
884
  if ( ! $has_query_tags ) {
885
+ /**
886
+ * Allow filtering whether to detect the pod name / item ID from the current post object.
887
+ *
888
+ * @since 2.7.26
889
+ *
890
+ * @param bool $detect_from_current Whether to detect the pod name / item ID from the current post object.
891
+ * @param array $shortcode_attributes The list of attributes used for the shortcode.
892
+ */
893
+ $detect_from_current = apply_filters( 'pods_shortcode_detect_from_current_post', in_the_loop(), $tags );
894
 
895
  // Archives, Post type archives, singular posts.
896
+ if ( $detect_from_current ) {
897
  $pod = pods( get_post_type(), get_the_ID(), false );
898
 
899
  if ( ! empty( $pod ) ) {
init.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pods - Custom Content Types and Fields
4
  Plugin URI: https://pods.io/
5
  Description: Pods is a framework for creating, managing, and deploying customized content types and fields
6
- Version: 2.7.25
7
  Author: Pods Framework Team
8
  Author URI: https://pods.io/about/
9
  Text Domain: pods
@@ -37,7 +37,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
37
  add_action( 'init', 'pods_deactivate_pods_ui' );
38
  } else {
39
  // Current version
40
- define( 'PODS_VERSION', '2.7.25' );
41
 
42
  // Version tracking between DB updates themselves
43
  define( 'PODS_DB_VERSION', '2.3.5' );
3
  Plugin Name: Pods - Custom Content Types and Fields
4
  Plugin URI: https://pods.io/
5
  Description: Pods is a framework for creating, managing, and deploying customized content types and fields
6
+ Version: 2.7.26
7
  Author: Pods Framework Team
8
  Author URI: https://pods.io/about/
9
  Text Domain: pods
37
  add_action( 'init', 'pods_deactivate_pods_ui' );
38
  } else {
39
  // Current version
40
+ define( 'PODS_VERSION', '2.7.26' );
41
 
42
  // Version tracking between DB updates themselves
43
  define( 'PODS_DB_VERSION', '2.3.5' );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
  Requires PHP: 5.3
8
- Stable tag: 2.7.25
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -190,6 +190,11 @@ We are also available through our [Live Slack Chat](https://pods.io/chat/) to he
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
193
  = 2.7.25 - December 28th 2020 =
194
 
195
  **New Features & Enhancements**
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
  Requires PHP: 5.3
8
+ Stable tag: 2.7.26
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
190
 
191
  == Changelog ==
192
 
193
+ = 2.7.26 - January 8th, 2021 =
194
+
195
+ * Fixed: Prevent PHP warnings in the `components/Templates/includes/element-pod_reference.php` file. #5914 (@JoryHogeveen)
196
+ * Added: New filter `pods_shortcode_detect_from_current_post` allows you to override whether a shortcode should detect the post object outside of the loop (default is only when `in_the_loop()`). This helps to fix problems that are part of the integration which the free Pods Beaver Themer Add-On uses. (@sc0ttkclark)
197
+
198
  = 2.7.25 - December 28th 2020 =
199
 
200
  **New Features & Enhancements**