Return to Snippet

Revision: 68075
at November 24, 2014 19:47 by burnandbass


Initial Code
<?php 
	if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
		if ( have_posts() ) :
				// Start the Loop.
				while ( have_posts() ) : the_post();
					
					?>
					<div data-title="<?php the_title(); ?>"></div>
					<?php
					get_template_part( 'content', get_post_format() );

				endwhile;
				

			else :
				// If no content, include the "No posts found" template.
				get_template_part( 'content', 'none' );

			endif;
			die();
	}
?>

Initial URL
www.bassta.bg

Initial Description
If you need on ajax request to get only the post content

Initial Title
WordPress - get only post content on ajax request

Initial Tags

                                

Initial Language
PHP