Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
- <div class="blog-post">
- <ul id="projects">
- <li>
- <div class="blog-post-title">
- <a class="project" rel="<?php the_permalink();?>" href="<?php the_permalink();?>">
- <?php the_title(); ?></a>
- </div>
- <span class="blog-post-meta"><?php echo get_the_date(); ?> by <a href="#"><?php the_author(); ?></a></span>
- </li>
- </ul>
- </div>
- <?php endwhile; endif; ?>
- </div>
- <div id="project-single">
- <div id="inner-single"></div>
- </div>
- jQuery(document).ready(function ($) {
- $.ajaxSetup({cache: false});
- $("a.project").click(function () {
- var post_link = $(this).attr("href");
- alert(post_id);
- $("#inner-single").html('<div class="loading">loading...</div>');
- $("#inner-single").load(post_link);
- return false;
- });
- });
- <?php $post = get_post($_POST['id']); ?>
- <div id="single-post post-<?php the_ID(); ?>">
- <?php while (have_posts()) : the_post(); ?>
- <?php the_content();?>
- </div>
- <?php endwhile;?>
- <?php get_footer(); ?>
- function ajax_enable () {
- wp_enqueue_script( 'admin_url', includes_url() . 'js/myajax.js', array( 'jquery' ) );
- $admin_url = array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ) );
- wp_localize_script( 'admin_url', 'AdminURL', $admin_url );
- }
- add_action( 'wp_enqueue_scripts', 'ajax_enable' );
Add Comment
Please, Sign In to add comment