Skip to content

Instantly share code, notes, and snippets.

@diviengine
Created January 14, 2021 19:38
Show Gist options
  • Save diviengine/859a0e40e3653bea256a5bfa02e540e2 to your computer and use it in GitHub Desktop.
Save diviengine/859a0e40e3653bea256a5bfa02e540e2 to your computer and use it in GitHub Desktop.
<?php
$product_content = apply_filters('the_content', get_post_field('post_content', $postID));
$product_content = preg_replace( '/et_pb_([a-z]+)_(\d+)_tb_body/', 'et_pb_df_ajax_filter_${1}_${2}_tb_body', $product_content );
$product_content = preg_replace( '/et_pb_([a-z]+)_(\d+)( |")/', 'et_pb_df_ajax_filter_${1}_${2}${3}', $product_content );
echo $product_content;
// retrieve the styles for the modules
$internal_style = ET_Builder_Element::get_style();
// reset all the attributes after we retrieved styles
ET_Builder_Element::clean_internal_modules_styles( false );
$et_pb_rendering_column_content = false;
// append styles
if ( $internal_style ) {
?>
<div class="df-inner-styles">
<?php
//$cleaned_styles = str_replace("#et-boc .et-l","#et-boc .et-l .filtered-posts", $internal_style);
$cleaned_styles = preg_replace( '/et_pb_([a-z]+)_(\d+)_tb_body/', 'et_pb_df_ajax_filter_${1}_${2}_tb_body', $internal_style );
$cleaned_styles = preg_replace( '/et_pb_([a-z]+)_(\d+)( |"|.)/', 'et_pb_df_ajax_filter_${1}_${2}${3}', $cleaned_styles );
printf(
'<style type="text/css" class="dmach_ajax_inner_styles">
%1$s
</style>',
et_core_esc_previously( $cleaned_styles )
);
?>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment