load content of post with ajax in div


I have a list of posts, if I click title display the post information in a div #post-container.

        <div class="postsilgle" id="post-container">
            <div class="dw-news">
                <a href="<?php the_permalink(); ?>">
                    <h2 class="post_title"><?php the_title() ?></h2>
                <?php the_excerpt(); ?>

<div class="posts-list">      
    <?php $query_args = array(
        'showposts' => 10,
        'post_status' => 'publish',
        'cat' => 15,
    $posts_query = new WP_Query($query_args);
    while ($posts_query->have_posts()):
        <a href="<?php the_permalinl" ?> title="<?php the_title() ?>" id="<?php echo get_the_ID() ?>">
            <article class="post">
                <div class="thumbnail">
                    <?php if (has_post_thumbnail()) ?>
                    <?php the_post_thumbnail(); ?>                       
                <div class="content">
                    <h2><?php the_title() ?></h2>
    <?php endwhile;
    wp_reset_query(); ?>
ali 4 months 0 Answers 19 views 0

Leave an answer