Blog

What’s New In Pods 2.4

Pods 2.4 started out as 2.3.19, a simple update with just a few bug fixes. Instead, over 100 commits later, 2.4 arrives today full of new features, as well as performance and UI improvements as well as compatibility with a new caching plugin. Also we have added auto-complete capabilities to the Pods Template editor for magic tags and plugin to make displaying Pods Templates in the front-end even easier. This new version is the easiest to use, and most customizable version of Pods yet. Of course, we are not done improving Pods. Be sure to follow the 3.0 milestone in our GitHub issue tracker to track our progress on the next major version of WordPress and to find ways to contribute. In addition to these new features and hooks, Pods 2.4 includes a large number of bug fixes. For the full run-down of what has changed see the changelog in the plugin’s readme. Pods 2.4 is tested to work with the new WordPress 3.9. You can update through the WordPress plugin updater or by downloading the newest version from wordpress.org/plugins/pods

New Pods Plugins

Pods Alternative Cache is a file-based or database-based caching solution for for hosts that have limitations on object caching. To use file-based caching, you simply need to install and activate the plugin. For more information see this post. Pods Frontier Auto Templates is a new plugin that automatically outputs Pods Templates for content type and custom taxonomy Pods. It is the first plugin to use our new Pods Plugin starter plugin Pods Extend. You can learn more about Pods Frontier Auto Templates here or learn more about creating your own Pods plugins here.

New Features

Auto-Complete Magic Tags In Pods Templates

When editing Pods Templates you now have two easy ways to determine the proper magic tag for both Pods fields and built-in WordPress fields. When editing a Pods Template, you can now choose from all current Pods which Pod to reference for auto-complete. After making this selection, you will see a list of available fields available to this Pod. In addition, when adding a magic tag to the template, their name will auto-complete, showing you all possible completions for the tag you started. auto-complete

Partial Forms

You can now use pods::form() to output fields from a Pods form only, without the rest of the HTML for the form. This is perfect for incorprating Pods form fields into custom forms. For more information see: https://docs.pods.io/code/pods/form/ Example usage: echo pods('jedi')->form( array( 'fields_only' => true, 'fields' => 'side_of_force', 'lightsaber_color' ) );

Create New Posts From A Relationship Field

Auto-complete relationship fields between two Pods can now be used to create a new item in the related Pod by selecting the “Taggable” option under the “Additional Field Options” tab. For now, this feature is only supported for content types added by Pods.

Optional Download Links In Post Editor For File Types

File upload fields now have a “Link to File in editor” option in their “Additional Field Options” tab. When enabled, in the post editor, you will see a link, and a preview of the file. This feature can also be used to easily reorder files when multiple values are enabled for the field. Previews for Pods upload fields.

Support For JetPack Publicize and Markdown Modules

When JetPack is enabled you can now  custom post type support for the Publicize and Markdown modules. This includes the ability to use markdown in paragraph fields.

Before And After Fields In List Items Widget

The Pods List Items widget now includes a “Before Content” and “After Content” field. Since this widget loops through a Pods Template, anything included in the template will be outputted once per item. These new fields are perfect for content that you do not want to be looped through, such as ul tags, subtitles, or text that you only want outputted at the end of the widget.

Changes To Field Labels In Pods Editor and New Help Bubbles

The labels for many fields in the Pods Editor have been changed to make their purpose more obvious. Many fields have new or changed help bubbles to better explain their purposes. These changes are to field labels not to their names. This means that these changes are purely UI changes and will not causes any backwards-compatibility issues.

Track Changes To Pods Fields

Changes to Pods fields can now be tracked via a variety of methods thanks to the new PodsAPI::get_changed_fields(). This method can be hooked to a presave filter or changes can be tracked via the new pods_api_save_pod_item_track_changed_fields_{POD_NAME}. More details about the new filter can be found below. Example usage of the new method: [gist id=”10686141″ file=”with-presave.php”] This example usage shows uses wp_die() for debugging purposes. It would allow you to see exactly how items are being saved. Since this data is generated before any content is saved, it is a perfect place to create custom data validation functionality or to create notifications or alerts based on the contents of fields.

Constant To Disable Shortcode Parameters That Might Be Used To Pass SQL

The new constant PODS_DISABLE_SHORTCODE_SQL, when enabled restricts Pods Shortcode paramters that could be used to pass SQL based arguments to prevent potential injection of malicious code. You can enable this by adding this line to your wp-config.php: define( 'PODS_DISABLE_SHORTCODE_SQL', true );

New Hooks

There are several new filters and actions in this version of Pods. All with complete inline docs.

Pre and Post Form Field Actions

There are now actions for outputting information before all fields in a form, before a specific field, after a specific field or after a fields. These actions are perfect for adding additional HTML markup to your form, or for use with captchas. Example usages: [gist id=”10601262″]

Filter Item Created Using Autocomplete Relationship Fields

Fields related to other content types can now be used to create new items in the related Pod when using multi-select, auto-complete fields with the new “taggable” option enabled. This filter exposes the array that is used to create the new item in the related Pod. It can be used to set the default status of new items to something other than ‘publish’ for example, ‘draft’. Example usage to accomplish this: [gist id=”10602071″]

Remove Pods Shortcode Button

Can be use to move the Pods shortcode button from the post editor. Example usage: add_filter( 'pods_admin_media_button', '__return_false' );

Pods Image Default

Set a global fallback image for pods_image(). For more information see: https://docs.pods.io/code/filter-reference/pods_image_default/

Track Changes To Fields

You can now enable tracking changes to fields, per Pod using the new pods_api_save_pod_item_track_changed_fields_{POD_NAME} filters. For example to enable tracking of changes for the Pods ‘jedi’ and ‘capital_ships’: [gist id=”10686141″ file=”enable-selective.php”] And to enable for all Pods: [gist id=”10686141″ file=”enable-for-all.php”]

Ignore Internal Content Types For Relationship Fields

You can now ignore internal content types for possible relationship field values with the ‘pods_pick_ignore_internal’ filter. Example usage: add_filter( 'pods_pick_ignore_internal', '__return_false' );