Show post content in other divs
-
Hi, I would like to ask if there is anybody who knows how to display the post content in the other div without having to refresh the page once you click the post title?
Here’s my code in the single.php:
<?php if ($slideQuery->have_posts()) : while ($slideQuery->have_posts()) : $slideQuery->the_post(); ?> <div id="<?php $category = get_the_category(); echo $category[0]->cat_name; ?>"> <a class="post-link" rel="<?php the_ID(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?> </a> </div> <?php $post = get_post($_POST['id']); ?> <div id="single-post-container"></div> <div id="single-post post-<?php the_ID(); ?>"> <?php the_content();?> </div> <?php endwhile; endif; ?>
and this is my code in the js:
$(document).ready(function(){ $.ajaxSetup({cache:false}); $(".post-link").click(function(){ var post_link = $(this).attr("href"); $("#single-post-container").html("content loading"); $("#single-post-container").load(post_link); return false; }); });
Thank you in advaced.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show post content in other divs’ is closed to new replies.