pods icon indicating copy to clipboard operation
pods copied to clipboard

_position doesn't work on nested [if]

Open gerardciclick opened this issue 2 years ago • 5 comments

Description

Using var _position in a nested [if] block doesn't work, but {@_position} prints correctly the loop index number.

<div>
	[if customtitle]
		<strong>{@customtitle}</strong>
		[if field="_position" value="2"]2nd loop[/if]
		{@_position}
	[/if]
</div>

Version

2.8.17

Testing Instructions

  1. create new custom post 'pod_test'
  2. Add a simple text custom field named 'customtitle'
  3. Create 3 'pod_test' entries with just the post title and some text in the customtitle field.
  4. Create a pod template named 'test-template' with this code:
<div>
	[if customtitle]
		<strong>{@customtitle}</strong>
		[if field="_position" value="2"]2nd loop[/if]
		{@_position}
	[/if]
</div>
  1. Call template from a shortcode: [pods name="pod_test" template="test-template"]
  2. It will never print "2nd loop". it only works if I get rid the first [if customtitle]:
<div>
		<strong>{@customtitle}</strong>
		[if field="_position" value="2"]2nd loop[/if]
		{@_position}
</div>

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

`
### wp-core ###

version: 5.9.3
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 3
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs
wordpress_size: 264.13 MB (276962935 bytes)
uploads_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/uploads
uploads_size: 41.26 MB (43265874 bytes)
themes_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/themes
themes_size: 31.78 MB (33321934 bytes)
plugins_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/plugins
plugins_size: 118.43 MB (124182228 bytes)
database_size: 41.53 MB (43548672 bytes)
total_size: 497.13 MB (521281643 bytes)

### wp-dropins (1) ###

maintenance.php: true

### wp-active-theme ###

name: the7dtchild (dt-the7-child)
version: 1.0.0
author: Dream-Theme
author_website: http://dream-theme.com/
parent_theme: The7 (dt-the7)
theme_features: core-block-patterns, widgets-block-editor, menus, automatic-feed-links, post-thumbnails, title-tag, align-wide, responsive-embeds, wp-block-styles, editor-styles, editor-style, editor-color-palette, presscore-modules, widgets
theme_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/themes/dt-the7-child
auto_update: Disabled

### wp-parent-theme ###

name: The7 (dt-the7)
version: 10.3.0 (latest version: 10.7.1)
author: Dream-Theme
author_website: http://dream-theme.com/
theme_path: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/themes/dt-the7
auto_update: Disabled

### wp-themes-inactive (1) ###

Twenty Twenty-One: version: 1.5, author: the WordPress team, Auto-updates disabled

### wp-plugins-active (20) ###

Advanced CF7 DB: version: 1.8.5, author: Vsourz Digital (latest version: 1.8.7), Auto-updates disabled
All In One WP Security: version: 4.4.10, author: Tips and Tricks HQ, Peter Petreski, Ruhul, Ivy (latest version: 4.4.12), Auto-updates disabled
Classic Editor: version: 1.6.2, author: WordPress Contributors, Auto-updates disabled
Contact Form 7: version: 5.5.4, author: Takayuki Miyoshi (latest version: 5.5.6), Auto-updates disabled
Cookies and Content Security Policy: version: 2.01, author: Jonk @ Follow me Darling (latest version: 2.06), Auto-updates disabled
Countdown Wpdevart: version: 2.3.9, author: wpdevart (latest version: 2.6.6), Auto-updates disabled
Disable Comments: version: 2.3.3, author: WPDeveloper (latest version: 2.3.5), Auto-updates disabled
Duplicate Post Page Menu & Custom Post Type: version: 1.9.2, author: Inqsys Technology (latest version: 2.1.0), Auto-updates disabled
Easy WP SMTP: version: 1.4.7, author: wpecommerce, alexanderfoxc, Auto-updates disabled
Email Encoder - Protect Email Addresses: version: 2.1.3, author: Ironikus, Auto-updates disabled
Page scroll to id: version: 1.7.5, author: malihu, Auto-updates disabled
Plausible Analytics: version: 1.2.2, author: PlausibleHQ (latest version: 1.2.3), Auto-updates disabled
Pods - Custom Content Types and Fields: version: 2.8.17, author: Pods Framework Team, Auto-updates disabled
Really Simple SSL: version: 5.2.3, author: Really Simple Plugins (latest version: 5.3.2), Auto-updates disabled
Slider Revolution: version: 6.5.12, author: ThemePunch, Auto-updates disabled
The7 Elements: version: 2.5.8, author: Dream-Theme, Auto-updates disabled
The7 WPBakery Page Builder: version: 6.6.0.1, author: Michael M - WPBakery.com, Auto-updates disabled
Ultimate Addons for WPBakery Page Builder: version: 3.19.11, author: Brainstorm Force, Auto-updates disabled
UpdraftPlus - Backup/Restore: version: 1.22.1, author: UpdraftPlus.Com, DavidAnderson (latest version: 1.22.12), Auto-updates disabled
Yoast SEO: version: 18.0, author: Team Yoast (latest version: 18.8), Auto-updates disabled

### wp-media ###

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1690
imagemagick_version: ImageMagick 6.9.10-68 Q16 x86_64 2021-10-14 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: File uploads is turned off
post_max_size: 8M
upload_max_filesize: 2M
max_effective_size: 2 MB
max_file_uploads: 20
imagick_limits: 
	imagick::RESOURCETYPE_AREA: 61 GB
	imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
	imagick::RESOURCETYPE_FILE: 6144
	imagick::RESOURCETYPE_MAP: 61 GB
	imagick::RESOURCETYPE_MEMORY: 30 GB
	imagick::RESOURCETYPE_THREAD: 1
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: not available

### wp-server ###

server_architecture: Linux 3.10.0-1127.10.1.el7.x86_64 x86_64
httpd_software: Apache
php_version: 7.4.29 64bit
php_sapi: fpm-fcgi
max_input_variables: 1000
time_limit: 30
memory_limit: 256M
max_input_time: 60
upload_max_filesize: 2M
php_post_max_size: 8M
curl_version: 7.29.0 NSS/3.53.1
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 5.5.68-MariaDB
client_version: mysqlnd 7.4.29
max_allowed_packet: 134217728
max_connections: 151

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content
WP_PLUGIN_DIR: /var/www/vhosts/thegreenscreen.europeangreens.eu/httpdocs/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: false
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: Undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

### pods ###

pods-server-software: Apache
pods-user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
pods-session-save-path: /var/lib/php/session
pods-session-save-path-exists: No
pods-session-save-path-writable: No
pods-session-max-lifetime: 1440
pods-opcode-cache-apc: No
pods-opcode-cache-memcached: No
pods-opcode-cache-opcache: No
pods-opcode-cache-redis: No
pods-object-cache-apc: No
pods-object-cache-apcu: No
pods-object-cache-memcache: No
pods-object-cache-memcached: No
pods-object-cache-redis: Yes
pods-memory-current-usage: 80.034M
pods-memory-current-usage-real: 16.000M
pods-network-wide: No
pods-install-location: /wp-content/plugins/pods/
pods-developer: No
pods-tableless-mode: No
pods-relationship-table-enabled: Yes
pods-light-mode: No
pods-strict: No
pods-allow-deprecated: Yes
pods-api-cache: Yes
pods-shortcode-allow-evaluate-tags: No
pods-sessions: Disable sessions
pods-can-use-sessions: No
pods-relationship-table-status: 62

`

Pods Package

{
    "meta": {
        "version": "2.8.17",
        "build": 1652689895
    },
    "pods": [
        {
            "name": "pod_test",
            "id": 59086,
            "label": "Pod tests",
            "description": "",
            "type": "post_type",
            "storage": "meta",
            "label_singular": "Pod test",
            "public": "1",
            "show_ui": "1",
            "rest_enable": "1",
            "supports_title": "1",
            "supports_editor": "1",
            "_migrated_28": "1",
            "required": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 59087,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "customtitle",
                            "id": 59088,
                            "label": "Title",
                            "description": "",
                            "weight": 0,
                            "type": "text",
                            "sister_id": "-- Select One --",
                            "required": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "roles_allowed": "administrator",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1"
                        }
                    ]
                }
            ]
        }
    ],
    "templates": [
        {
            "name": "test-template",
            "code": "<div>\r\n\t\t<strong>{@customtitle}<\/strong>\r\n\t\t[if field=\"_position\" value=\"2\"]2nd loop[\/if]\r\n\t\t{@_position}\r\n<\/div>",
            "id": 59074,
            "_edit_lock": "1652689887:1",
            "_edit_last": "1",
            "pod_reference": {
                "pod": ""
            }
        }
    ]
}

gerardciclick avatar May 16 '22 08:05 gerardciclick

@sc0ttkclark Might be a regression but anything you can quickly think of? Otherwise I'll dive into this one :)

JoryHogeveen avatar May 16 '22 10:05 JoryHogeveen

You can take a look @JoryHogeveen, I don't have any ideas at the moment

sc0ttkclark avatar May 16 '22 11:05 sc0ttkclark

Probably related: https://wordpress.org/support/topic/shortcode-to-check-the-_total/

JoryHogeveen avatar May 23 '22 10:05 JoryHogeveen

There's some work in Pods 2.8.23 to address this, I'd love if you could test it once it's released to confirm it resolves your issue here.

sc0ttkclark avatar Jul 04 '22 14:07 sc0ttkclark

Reopening until we can confirm it's solved

sc0ttkclark avatar Jul 05 '22 13:07 sc0ttkclark

I just confirmed this is working as expected locally with Pods 2.9.4, may have already been fixed as part of 2.8.23

sc0ttkclark avatar Sep 13 '22 14:09 sc0ttkclark