WordPress.org

Ready to get started?Download WordPress

Forums

An AJAX function doesn't recognize mi plugins (1 post)

  1. wr276
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic