Plugin Author
YOP
(@yourownprogrammer)
Hello
I’ve tested the link you posted but it asks for username and password.
Can you look into this and let us know when we can try again?
Sorry, I am unable to share the login details of the subscribed user. In my subscriber account we have specials blog posts. We are showing those blogs titles as buttons and click on that it will pass the id of the post to an ajax call and list the blog details to div using jquery ajax. If I post the poll short code inside the post content its displaying as it is in the ajax response. Below is my ajax response code
$(function(){
$(".text-area .sbblogs").click(function(e){
e.preventDefault(); //To prevent the default anchor tag behaviour
$(".text-area .sbblogs").removeClass('selected');
$(this).addClass('selected');
var url = this.href;
var post_id = $(this).attr("post-id");
var ajaxURL = woocommerce_params.ajax_url;
var ele = this;
$.ajax({
type: 'POST',
url: ajaxURL,
data: {"action": "load-post-content", post_id: post_id },
scriptAttrs: { nonce: "Xiojd98a8jd3s9kFiDi29Uijwdu" },
success: function(response) {
//console.log(response);
$(".projectpreviewContent").html(response);
return false;
}
});
});
});
Plugin Author
YOP
(@yourownprogrammer)
I think I understand what you’re trying to accomplish.
Can you also share the php code that gets the post content from the db and sends it back?
This is the code I am using to list the blog content in my them's functions.php
function my_load_ajax_post_content()
{
$post = get_post($_POST['post_id']);
get_template_part( 'contentblog', 'page', array('post' => $post));
exit;
}
add_action( 'wp_ajax_load-post-content', 'my_load_ajax_post_content' );
add_action( 'wp_ajax_nopriv_load-post-content', 'my_load_ajax_post_content' );
Also in my poll option I am using an "Other" option with a text box. Is it safe to use? Are you sanitizing the data before inserting it into DB? Please confirm.
Plugin Author
YOP
(@yourownprogrammer)
After calling get_post I think you need to call do_shortcode.
something like this
$post = get_post($_POST['post_id']);
$content = do_shortcode( $post['post_content'] );
can you give it a try?
Plugin Author
YOP
(@yourownprogrammer)
@bvk69varghese were you able to get it to work?