Skip to content

Commit dee4d9e

Browse files
committed
display dynamic content values in blocksy content blocks
1 parent 1df86a7 commit dee4d9e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
// Exit if accessed directly.
4+
if ( ! defined( 'ABSPATH' ) ) {
5+
exit;
6+
}
7+
8+
if ( ! function_exists( 'stackable_blocksy_parse_field_data_current_post_id' ) ) {
9+
// When using Blocksy Content Blocks, sometimes the get_the_ID() returns 0.
10+
function stackable_blocksy_parse_field_data_current_post_id( $post_id, $field_data, $route ) {
11+
if ( class_exists( 'Blocksy_Translations_Manager' ) && $post_id == 0 ) {
12+
$post_id = get_queried_object_id();
13+
}
14+
return $post_id;
15+
}
16+
17+
add_filter( 'stackable_dynamic_content/parse_field_data/current_post_id', 'stackable_blocksy_parse_field_data_current_post_id', 10, 3 );
18+
}

src/compatibility/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
require_once( plugin_dir_path( __FILE__ ) . './neve/index.php' );
99
require_once( plugin_dir_path( __FILE__ ) . './woocommerce.php' );
10+
require_once( plugin_dir_path( __FILE__ ) . './blocksy/index.php' );

0 commit comments

Comments
 (0)