CodeHQ

Archive for August, 2016

|

Display taxonomy term name | WordPress

Thursday, August 18th, 2016

Tags: , , , , , , ,
Posted in PHP, WordPress | No Comments »

Exclude current post from WordPress query

Wednesday, August 17th, 2016

Get the current page ID and use that in the WordPress query to exclude that post from displaying.

<?php $currentID = get_the_ID();?>

<?php $args = array(
	'post_type' => 'post',
	'post__not_in' => array($currentID)
);

$query = new WP_Query($args);

 $i = 1;

while ( $query->have_posts() ) : $query-> the_post(); ?>

Tags: , , , ,
Posted in PHP, WordPress | No Comments »