elementor / elementor/elementor

⌛ 📚 🧩 Dynamic Image Not Working

Open
#30,424 3 comments 0 reactions 0 assignees View on GitHub
compatibility/3rd-party-code component/pro/dynamic-tag mod* mod/b* mod/c* mod/e* product/pro status/evaluating type/developer-api
Dominant language
PHP
Stars
7.1k
Forks
1.6k
Avg merge
1d 5h
Merged PRs (30d)
193

Description

### Prerequisites

- [x] I have searched for similar issues in open and closed tickets and cannot find a duplicate.
- [ ] I have troubleshooted my issue, and it still exists against the latest stable version of Elementor.

### Description

I am trying to implement a dynamic tag for images for custom post type.

here is my code

```php
class Elementor_Dynamic_Tag_Avowal_Photo extends \Elementor\Core\DynamicTags\Tag
{
public function get_name(): string
{
return 'avowal_review_photo';
}

public function get_title(): string
{
return esc_html__('Avowal Review Photo', '');
}

public function get_group(): array
{
return ['avowal_review'];
}

public function get_categories(): array
{
return [\Elementor\Modules\DynamicTags\Module::IMAGE_CATEGORY];
}

public function get_value(array $options = [])
{

return [
'url' => 'https://cdn.beejameditation.com/front/assets/img/_avtar.png',
'id' => 0, // If using an attachment ID, replace 0 with the ID
];
}

public function render()
{
$image_url = 'https://cdn.beejameditation.com/front/assets/img/_avtar.png';

if ($image_url) {
echo 'Custom Image';
}
}
}
```

The problem is that nothing gets outputted to the screen, I am using element pro Version: 3.25.4

### Steps to reproduce

1. Create a custom post type
2. register a dynamic tag with IMAGE_CATEGORY
3. Using a post-grid Loop, try to display the Image.
4. The image does not display on the frontend

### Expected behavior

1. Image should display on the frontend

### Isolating the problem

- [ ] This bug happens when only the Elementor (and Elementor Pro) plugins are active.
- [ ] This bug happens with the Hello Elementor theme active.
- [x] I can reproduce this bug consistently by following the steps I described above.

### Elementor System Info

Click to reveal

````txt

== Server Environment ==
Operating System: Darwin
Software: nginx/1.26.1
MySQL version: MySQL Community Server - GPL v8.0.16
PHP Version: 8.1.23
PHP Memory Limit: 256M
PHP Max Input Vars: 4000
PHP Max Post Size: 1000M
GD Installed: Yes
ZIP Installed: Yes
Write Permissions: All right
Elementor Library: Connected

== WordPress Environment ==
Version: 6.7.2
Site URL: http://avowal.local
Home URL: http://avowal.local
WP Multisite: No
Max Upload Size: 300 MB
Memory limit: 40M
Max Memory limit: 256M
Permalink Structure: /%postname%/
Language: en_US
Timezone: 0
Debug Mode: Active

== Theme ==
Name: Twenty Twenty-Five
Version: 1.0
Author: the WordPress team
Child Theme: No

== User ==
Role: administrator
WP Profile lang: en-US
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36

== Active Plugins ==
Avowal Plugin
Version: 0.1
Author: SkillSeeds Limited

BuddyPress
Version: 14.3.3
Author: The BuddyPress Community

Elementor
Version: 3.25.11
Author: Elementor.com

Elementor Pro
Version: 3.25.4
Author: Elementor.com

Open Graph and Twitter Card Tags
Version: 3.3.3
Author: WPExperts

WooCommerce
Version: 9.4.3
Author: Automattic

== Features ==
Custom Fonts: 0
Custom Icons: 0

== Integrations ==

== Elementor Experiments ==
Improved CSS Loading: Inactive by default
Inline Font Icons: Active by default
Additional Custom Breakpoints: Active by default
Container: Active by default
Upgrade Swiper Library: Active by default
Nested Elements Performance: Active by default
Optimized Control Loading: Active by default
Optimized Markup: Inactive by default
Conditionally load Swiper CSS files: Inactive by default
Plugin Onboarding: Active by default
CSS Smooth Scroll: Active by default
Default to New Theme Builder: Active by default
Elementor Home Screen: Active by default
Landing Pages: Inactive by default
Nested Elements: Active by default
Editor Top Bar: Active by default
Pages Panel: Inactive by default
Element Caching: Active by default
Link In Bio: Active by default
Floating Buttons: Active by default
Elementor Editor Events: Inactive by default
Atomic Widgets: Inactive by default
Launchpad Checklist: Active by default
Menu: Inactive by default

== Log ==

Log: showing 5 of 52024-12-11 10:46:39 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor Pro',
'from' => '3.19.3',
'to' => '3.25.4',
)]
2024-12-11 10:46:42 [info] elementor-pro::elementor_pro_updater Started
2024-12-11 10:46:42 [info] Elementor Pro/Upgrades - _on_each_version Start
2024-12-11 10:46:42 [info] Elementor Pro/Upgrades - _on_each_version Finished
2024-12-11 10:46:42 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor Pro',
'from' => '3.19.3',
'to' => '3.25.4',
)]

PHP: showing 1 of 1PHP: 2024-12-11 11:18:11 [warning X 27][../elementor-pro/modules/theme-builder/classes/conditions-manager.php::182] Undefined array key "editor_post_id" [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]

JS: showing 5 of 5JS: 2024-12-12 13:51:31 [error X 1][../elementor/assets/js/packages/editor-documents/editor-documents.min.js?ver=3.25.11:1:2102] Cannot read properties of null (reading 'config')
JS: 2024-12-12 13:56:10 [error X 2][../elementor/assets/js/editor.min.js?ver=3.25.11:3:622598] Cannot read properties of null (reading 'id')
JS: 2025-01-27 07:36:39 [error X 10][../elementor/assets/js/editor.min.js?ver=3.25.11:3:1274813] Cannot read properties of null (reading 'getBoundingClientRect')
JS: 2025-01-27 13:49:47 [error X 1][../elementor/assets/js/editor.min.js?ver=3.25.11:3:650613] Cannot read properties of null (reading 'data')
JS: 2025-02-24 07:34:08 [error X 1][../elementor/assets/js/editor.min.js?ver=3.25.11:3:779491] Cannot read properties of null (reading '$element')

== Elementor - Compatibility Tag ==

Elementor Pro: Compatible

== Elementor Pro - Compatibility Tag ==

````

### Agreement

- [x] I agree that my issue may be closed without action if it doesn't meet all the requirements.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.