Hi,
The Enfold page source code in the debug field is an extremely handy tool, and I would like to use it for some adaptations (to create a variation of a page programmatically). I know it is activated by adding the function builder_set_debug in functions.php.
Can you tell me if there is a possibility or any way to access the ALB page code even if the function builder_set_debug is NOT activated in the functions.php?
Thanks in advance for your help,
Rob
Hey Rob,
Thank you for the inquiry.
Are you trying to access the content of the advance layout builder? The content is actually saved as the post content, so you should be able to use the get_the_content function to retrieve it.
// https://developer.wordpress.org/reference/functions/get_the_content/
The shortcodes or builder elements are also saved as a custom field with the name _aviaLayoutBuilderCleanData.
// https://developer.wordpress.org/reference/functions/get_post_meta/
An example of this can be found in the template-builder.php file (starting line 64).
{
/**
* Filter the content for content builder elements
*/
$content = apply_filters( 'avia_builder_precompile', get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) );
}
else
{
/**
* If user views a preview we must use the content because WordPress doesn't update the post meta field
*/
$content = apply_filters( 'avia_builder_precompile', get_the_content() );
/**
* In preview we must update the shortcode tree to reflect the current page structure.
* Prior make sure that shortcodes are balanced.
*/
Avia_Builder()->get_shortcode_parser()->set_builder_save_location( 'preview' );
$content = ShortcodeHelper::clean_up_shortcode( $content, 'balance_only' );
ShortcodeHelper::$tree = ShortcodeHelper::build_shortcode_tree( $content );
}
Best regards,
Ismael
Hi Ismael,
Thanks for the info, that was exacly what I was looking for. Great! Solved :-)
Have a good day,
Rob