Last active
December 15, 2015 16:29
-
-
Save kylelarkin/5289126 to your computer and use it in GitHub Desktop.
AJAX include for WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('WP_USE_THEMES', false); | |
require_once('../../../../wp-load.php'); | |
?> | |
<?php $term = $_POST['term']; ?> | |
<?php $the_query = new WP_Query(array('feature-types'=>$term)); ?> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?><!-- start loop --> | |
<article> | |
<h1><?php the_title(); ?></h1> | |
<?php the_advanced_excerpt(); ?> | |
<footer>By <?php the_author(); ?> on <?php echo get_the_date('F jS, Y'); ?></footer> | |
</article> | |
<?php endwhile; ?><!-- end loop --> | |
<?php if(!$the_query->have_posts()) | |
echo 'There are currently no Features with this category. Please check back soon.'; | |
?> | |
<?php wp_reset_postdata(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment