So Ive almost completed this project. Im using custom fields, and a custom search (wpdb) to deal with my posts.
My problem, and this is huge, is that when I go to manage my posts and hit trash, they still exist in the DB.
So my custom search and the way I display my posts (modified search, Im filtering based on a custom field and putting the results in tables) doesnt work because the stuff I trash STILL shows up :/
here is my code:
for($t=1; $t<=2; $t++){
$postids=$wpdb->get_col($wpdb->prepare("
SELECT DISTINCT post_id
FROM wp_postmeta
WHERE post_id IN (SELECT post_id
FROM wp_postmeta
WHERE ( meta_key = 'Bedrooms'
AND meta_value = '$t' ))
AND post_id IN (SELECT post_id
FROM wp_postmeta
WHERE ( meta_key = 'Active'
AND meta_value = 'Yes' ))
AND post_id IN (SELECT post_id
FROM wp_postmeta
WHERE ( meta_key = 'listType'
AND meta_value = 'Rental' ))
",$t)); ?>
<table class="myTable">
<thead>
<tr>
<th><?php echo($t.' Bedrooms'); ?></th>
<th>Price</th>
<th>Available</th>
</tr>
</thead>
<?php
$tr = 0;
if (!empty($postids)) {
foreach ($postids as $id) {
$tr++;
if($tr%2){$trClass="dark";}else{$trClass="light";}
$post=get_post(intval($id));
setup_postdata($post);
$utilities = get('Utilities');
?>
<tr class="<?php echo ($trClass); ?>">
<td class="address"><a href="<?php the_permalink(); ?>"><?php
echo get('Address');
?></a>
</td>
<td class="price"><a href="<?php the_permalink(); ?>"><?php
echo ('$'. get('Price'));
?></td></a>
<td class="date"><a href="<?php the_permalink(); ?>"><?php
echo get('Availability');
?></td></a>
</tr>
<?php
}
} wp_reset_query();
?>
</table>
<?php
}
?>