load content of post with ajax in div

Question

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

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

<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()):
        $posts_query->the_post();
        ?>
        <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>
                <div class="content">
                    <h2><?php the_title() ?></h2>
                </div>
            </article>
        </a>
    <?php endwhile;
    wp_reset_query(); ?>
</div><?php
0
ali 4 months 0 Answers 19 views 0

Leave an answer