• wr276

    (@wr276)


    I have this function on functions.php on my theme:

    add_action('wp_ajax_get_single_post', 'single_post_callback');
    function single_post_callback(){
    if (isset($_POST['postName'])) {
    $postName = $_POST['postName'];
    $queryargs = array('showposts' => 1, 'name' => $postName);
    $myquery = new WP_Query($queryargs);
    if ($myquery->have_posts()) {
    while ($myquery->have_posts()) : $myquery->the_post();
     ?> <h2> <?php the_title(); ?> </h2> <?php
    the_content();
    endwhile;
    }
    else {
    	echo "No post with name " . $postName;
    }
    
    die();
    }
    else echo "No postName";
    }

    The problem is that the_content() function show this when I have shortcodes on my post instead of the plugin functionality that mus display:

    [download#15]

    [contact-form 6 "Name of form"]

    Any ideas?

  • The topic ‘An AJAX function doesn't recognize mi plugins’ is closed to new replies.