Browse files

FusionTables / Do a lil bit of error checking in the templates.

  • Loading branch information...
1 parent 65b9597 commit cb9bfb8d57f5451bf8308efefb516e09395c4449 @radgeek committed Nov 19, 2012
Showing with 16 additions and 0 deletions.
  1. +12 −0 card.php
  2. +4 −0 extensions/fusion/occupysandyfrontend.php
View
12 card.php
@@ -1,6 +1,16 @@
<?php
// Prepare data for use in template.
$card = get_the_occupy_sandy_card();
+
+if (is_wp_error($card)) :
+?>
+<div class="card error <?php print $card->get_error_code(); ?>">
+<h5 class="cardType">Back-End Error</h5>
+<p><?php print $card->get_error_message(); ?></p>
+</div>
+
+<?php
+else :
$classes = array('card', $card->get_card_class());
$state = $card->get_state();
$address = $card->get_address();
@@ -64,4 +74,6 @@
<?php endif; ?>
</div>
+<?php
+endif;
View
4 extensions/fusion/occupysandyfrontend.php
@@ -104,6 +104,10 @@ function the_occupy_sandy_cards ($params = array()) {
endif;
$cards = get_occupy_sandy_cards($params);
+ if (is_wp_error($cards)) :
+ $cards = array($cards);
+ endif;
+
foreach ($cards as $card) :
$OccupySandyCard = $card;

0 comments on commit cb9bfb8

Please sign in to comment.