Execute shortcodes found in the description fields, by applying the WP filter 'the_content'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'mkl_product_configurator_get_front_end_data', function( $data ) { | |
// Filter the choices | |
if ( isset( $data['content'] ) && is_array( $data['content'] ) ) { | |
foreach( $data['content'] as $lin => $layer ) { | |
foreach( $layer['choices'] as $cin => $choice ) { | |
if ( isset( $choice['description'] ) ) { | |
$data['content'][$lin]['choices'][$cin]['description'] = apply_filters( 'the_content', $choice['description'] ); | |
} | |
} | |
} | |
} | |
// Filter the layers | |
if ( isset( $data['layers'] ) && is_array( $data['layers'] ) ) { | |
foreach( $data['layers'] as $lind => $layer ) { | |
if ( isset( $layer['description'] ) ) { | |
$data['layers'][$lind]['description'] = apply_filters( 'the_content', $layer['description'] ); | |
} | |
} | |
} | |
return $data; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment