function ddl_load_comments_page_content() { $nonce = $_POST["wpnonce"]; if (!wp_verify_nonce($nonce, 'ddl_comments_listing_page')) { echo 'Error'; } else { global $wpddlayout, $wp_query, $withcomments, $wpdb, $id, $post, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage; if (!isset($_POST['page']) && !isset($_POST['postid'])) { echo 'Error'; } $load_page = $_POST['page']; // Current page to load $post_id = $_POST['postid']; $post = get_post($post_id); // Get post setup_postdata($post); // load global $post $comments = ddl_load_comments_array(); set_query_var('cpage', $load_page); //Set query page $overridden_cpage = true; $wp_query->query = array('page_id' => $post->ID, 'cpage' => $load_page); set_query_var('post_id', $post->ID); set_query_var('p', $post->ID); $wp_query->is_singular = 1; $layout_id = $_POST['layout_name']; $cell_id = $_POST['cell_id']; get_the_ddlayout($layout_id); global $wpddlayout; $wpddlayout->set_up_cell_fields_by_id($cell_id, $layout_id); $post = get_post($post_id); // Get post setup_postdata($post); // load global $post } $comments_list = ddl_render_comments_list($comments, $post, $load_page); echo $comments_list; die; }
/** * * the_ddlayout * * Renders and echos the layout. * */ function the_ddlayout($layout = '', $args = array()) { echo get_the_ddlayout($layout, $args); }