I have a problem working on a wordpress page based on the X theme.
I am currently trying to dynamically load pages into the main page with AJAX. For this I created a script making a request to admin-ajax.php
which works flawlessly.
Now the tricky part: I added a PHP snippet with the plugin Code Snippets containing the following code:
function get_case() {
$postNo = intval( $_POST['case'] );
$post = get_post($postNo);
$content = apply_filters('the_content', $post->post_content);
exit( $content );
}
add_action( 'wp_ajax_get_case', 'get_case' );
add_action( 'wp_ajax_nopriv_get_case', 'get_case' );
This code returns correct results if I am using the wordpress page builder, however it simply returns the shortcodes of the theme if the page was built in Cornerstone.
e.g.
[cs_element_section _id=”1″][cs_element_row _id=”2″]...
Am I doing this correctly? Is there any other way to dynamically load sub pages?
Thanks in advance.