pdclark
Forum Replies Created
-
The most basic method of displaying video from a URL of an mp4 file is an HTML video tag.
Within Elementor and most page builders, you can output raw HTML with a shortcode module
See https://docs.pods.io/displaying-pods/pods-shortcode/
For example:
[pods]<video width="320" height="240" controls><source src="{@name_of_field_with_video_file}" type="video/mp4"></video>[/pods]O ile utworzony typ wpisu ma w zakładce „Opcje zaawansowane” zaznaczone opcje „Publiczny” i „Dostępny do wyszukiwania”, taksonomia powinna wyświetlać typy wpisów w swojej zakładce „Połączenia”, a typ wpisu powinien wyświetlać taksonomie w swojej zakładce „Połączenia” — połączenie można skonfigurować z dowolnej strony.
Jeśli wyświetlanie nie wygląda tak, jak powinno, sprawdź, czy to, co miało być typem wpisu, rzeczywiście jest typem wpisu i czy jest publiczne, a także upewnij się, że archiwa i zapytania publiczne są włączone. Sprawdź również, czy to, co utworzyłeś jako taksonomię, rzeczywiście jest taksonomią.
Jeśli chodzi o utworzenie taksonomii o nazwie „miesiąc”, warto rozważyć alternatywne metody, widżety, zapytania lub wtyczki, które pozwolą wyświetlać treści według miesięcy bez konieczności dodawania dodatkowego pola: ponieważ posty mają już datę publikacji, istnieje wiele sposobów na wyszukiwanie treści według daty – nie musi to być podział na dni, ale można je również wyświetlać lub wyszukiwać według miesięcy.
Shortcodoes and Pods templates are both markup languages powered by text substitution… they’re not full programming languages, not aware of each other’s context for security reasons.
Because of that, barriers related to nested logic, order of execution, and mixed languages can cause things such as a magic tag passed as an argument to a shortcode within a template tag to not work as one might expect.
Here is an alternative approach, adding a shortcode with PHP in a plugin file, theme functions.php, or code snippet plugin, which then allows the template to be simpler:
<?php
/**
* Plugin Name: Terrain Image Shortcode
* Description: <code>[terrain image="1"]</code>
*/
add_shortcode(
'terrain',
function( $atts, $content, $tag ) {
if ( ! array_key_exists( 'image', $atts ) ) {
$atts['image'] = '1';
}
if ( ! array_key_exists( 'height', $atts ) ) {
$atts['height'] = '56.25%';
}
$image_id = pods()->field( 'terrain_slider_image_' . $atts['image'] );
if ( empty( $image_id ) ) {
return '';
}
return (string) apply_shortcodes(
sprintf(
'[ux_image id="%s" height="%s" lightbox="true" lightbox_image_size="original"]',
$image_id,
$atts['height']
)
);
}
);Where the template:
[if terrain_slider_image_1]
[ux_image id="{@terrain_slider_image_1}" height="56.25%" lightbox="true" lightbox_image_size="original"]
[/if]would then be replaced with:
[terrain image="1" height="56.25%"]Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Post Type not showing in elementorThe question appears to be why custom post types are not displayed in the Elementor Display Conditions menu: https://elementor.com/help/conditions/
Display conditions are a feature of Elementor Pro.
Based on a best guess, Elementor Pro seems to need the following settings to display a post type in that menu:
- Post type must be public and publicly queryable
- Post type must have an archive
- Post type must be set to display nav menus (this setting in Pods may be under the
Admin UItab,Show in Navigation Menus)
As far as I can tell, the navigation menus requirement is set by method
get_public_post_typesinelementor-pro/core/utils.php. The requirements of what causes a post type to appear or not is filterable there with filter nameelementor_pro/utils/get_public_post_types.Further details, verification, or support the Elementor Pro features would be best followed up on by the Elementor Pro team.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Breakdance builder supported?Pods is a general-purpose plugin for editing data structures available from and supported by WordPress core .
Due to the nature of creating custom data structures, as well as the nature of page builders, there are many routes to achieving many goals. It depends on what you would like to create, and how you create it.
Generally, all page builders support shortcodes, and the Pods shortcode is a free feature: https://docs.pods.io/displaying-pods/pods-shortcode/
If you would like functionality in Breakdance similar to the Pods blocks in the WordPress core block editor, many page builders are supported by the Page Builder Toolkit linked in the Pods readme. Breakdance is not currently supported, though future support is planned.
For using shortcodes within Breakdance, see Breakdance docs: shortcode and shortcode wrapper.
It’s difficult to say without access to WPML and your exact configuration, but it sounds like a WPML filter is mixing data types in a way that block filters don’t expect (array instead of string for an attribute).
Here are some filters which might resolve or narrow down the issue if added as a plugin, theme functions.php, or with a code snippets plugin:
<?php
// Sanitize block attributes to strings before kses.
add_filter(
'pre_kses_block_attributes',
function( $attr, $block, $content ) {
if ( is_array( $attr ) || is_object( $attr ) ) {
$attr = json_encode( $attr );
}
return (string) $attr;
},
PHP_INT_MAX,
3
);
// Similar, more general.
add_filter(
'wp_kses_content',
function( $content, $allowed_html, $allowed_protocols ) {
if ( is_array( $content ) || is_object( $content ) ) {
return (string) implode( '', (array) $content );
}
return $content;
},
PHP_INT_MIN,
3
);<?php
add_filter(
'pods_shortcode_findrecords_params',
function( $find_args, $pods, $shortcode_args ) {
$find_args['offset'] = 1;
return $find_args;
},
10,
3
);…where
$find_argswill contain arguments passed through the block fields corresponding to https://docs.pods.io/code/pods/find/,$podswill contain the Pods object, and$shortcode_argswill contain arguments corresponding to https://docs.pods.io/displaying-pods/pods-shortcode/To differentiate different blocks, you’ll need to set some parameters such as template contents to be unique between the two, then use an if statement to set the new query arguments as desired. The argument contents can be output for example with
error_log( print_r( [ $find_args, $shortcode_args ], true ) );The reason the issue is difficult to solve expeditiously is because the challenge sits at the border of where data duplication plugins and Pods meet:
- Pods defines a data structure. For some complex data types, such as images, more than one WordPress core field is used to store data in cases where WordPress core data structures would not support certain functionality
- Many third-party plugins provide a quick “duplicate” button for duplicating data. Most of these plugins do not check for extra associated data.
For the problem to be solved by the Pods team, we would have to either take on the challenge of maintaining patches or notifications for all other plugins, or would have to change data structures in significant ways, potentially introducing new problems for many thousands of sites and applications.
WordPress core import/export works fine with Pods data structures for duplicating or importing data.
Likewise, WordPress multisite for translation and WordPress core localization functions work correctly with Pods.
Unfortunately, it is not within plugin scope, nor within our realm of authority, to change features provided by other plugins.
The relevant data structures, for those writing their own import/export/duplicate scripts is that for a given field with wp_postmeta or wp_termmta
meta_keyfield_name, there will be an additional field named_pods_field_namecontaining enriched data for the Pods admin interface.Pods API provides the pods()->save() method as one way to save data quickly for custom scripts.
WordPress core import/export also works correctly, as it copies/migrates all data associated per post without making assumptions as to the meaning or use of data structures.
No, for comparing multi-dimensional data structures, either separate the templates out into Pods queries filtered with
whereSQL statements andIN( ... ), or use PHP / custom shortcodes with array comparisons.See:
- https://docs.pods.io/displaying-pods/pods-shortcode/ (where argument)
- https://docs.pods.io/code/pods/find/ (where syntax examples)
- https://www.w3schools.com/mysql/mysql_in.asp (MySQL IN() statement)
- https://www.php.net/manual/en/ref.array.php (PHP array functions)
- https://developer.ww.wp.xz.cn/reference/functions/add_shortcode/ (WordPress add shortcode)
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Pods shortcut in other Pods templateAdd this to
wp-config.php:define( 'PODS_SHORTCODE_ALLOW_SUB_SHORTCODES', true );…to allow shortcodes to be used within Pods templates / shortcodes
See https://docs.pods.io/troubleshooting-pods/pods-constants-for-wp-config/
The notice for timing for text domain loading in WP 6.7 and later was addressed in the Pods core plugin, so unless the requirement has regressed, the most likely cause would be an additional plugin or custom code which initializes Pods without using a hook or filter
For example, hook
initwith priority20should be fine, while code put into a plugin or theme without an action or filter wrapping it could cause the notice.The message doesn’t have any functional repercussions at this time, other than writing to the logs.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] The PODS Add-On requires??The message means there is a third plug-in, which requires the two plug-ins mentioned if it is to be activated.
From the list of Plugins, it might be:
CIO Custom Fields Importer Pro: version: 1.4.1 we're on the wayIn addition to the message, when plug-in requirements exist, the requirements are also sometimes listed under the title of the plug-in on the plug-in screen
WP All Import has filters for modifying the import process with additional code.
One such filter is pmxi_saved_post, which receives the ID of the post being saved as the first argument, and a SimpleXMLElement object representing the content being imported as the second argument.
Within that hook or similar, the
pods()->save()method can be used to associate a taxonomy term or taxonomy term relationship field with the post.The format of data given to save is an array where the keys are the field names and the values are the field values.
For a taxonomy or a taxonomy relationship field, the value of the field would be an array of term IDs for multi-select
[ 1, 2, 3 ]or just one ID321as an integer if a single-select relationship.WP’s get_term_by() can get a term object by name or slug. The field with the ID in the WP_Term object is
term_id.If there is only one taxonomy being associated, input may still need to be an array if it is a multi-select field:
'relationship_field_name' => [ $term->term_id ],or just the ID if single-select:'relationship_field_name' => $term->term_id,Reverting to Pods version
3.3.4with WP Rollback should resolve the issue.Pull Request 7499 has been opened on GitHub to resolve the issue going forward.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] Searching PODS Fields PluginFor Search and Filter Pro, I don’t have access to the plugin, but their documentation seems to indicate that a search field needs to be configured with a Query, Data Type, and Data Source: