Advertisement
rakeshr

temp-if else within foreach

Sep 20th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. <?php
  2. //list terms in a given taxonomy
  3. $taxonomy = 'inserttypes';
  4. $args=array(
  5.   'hide_empty' => false,
  6.   'orderby' => 'name',
  7.   'order' => 'ASC',
  8. );
  9. $terms = get_terms($taxonomy);
  10. foreach ($terms as $term) {echo '<div style="margin:0 auto; width="100%"><h2>'.$term->name.'</h2></div>';
  11.     $description=term_description($term->term_id,$taxonomy);
  12.     echo $description;
  13.    
  14. if ($description == 'a')
  15.         echo '<table width="98%" border="0" cellspacing="0" cellpadding="5">
  16.  <tr style="background:#ee2626; color:#fff; height:10px;">
  17.    <td align="left" valign="top">Model</td>
  18.    <td align="left" valign="top">Year</td>
  19.    <td align="left" valign="top">Left Mount</td>
  20.    <td align="left" valign="top">Right Mount</td>
  21.    <td align="left" valign="top">Rear Mount</td>
  22.    <td align="left" valign="top">Front Mount</td>
  23.    <td align="left" valign="top">All Mount Combo Kits</td>
  24.  </tr>';
  25.  
  26. if ( $description=='b' )    
  27.     echo '<table width="98%" border="0" cellspacing="0" cellpadding="5">
  28.  <tr style="background:#ee2626; color:#fff; height:10px;">
  29.    <td align="left" valign="top">Model</td>
  30.    <td align="left" valign="top">Year</td>
  31.    <td align="left" valign="top">Upper Mount</td>
  32.    <td align="left" valign="top">Lower Torque Strut</td>
  33.    <td align="left" valign="top">Front Trans Mount</td>
  34.    <td align="left" valign="top">Rear Trans Mount</td>
  35.    <td align="left" valign="top">All Mount Combo Kits</td>
  36.  </tr>';
  37.  
  38.  
  39.    
  40.    
  41.    
  42. $wpq = array ('taxonomy'=>$taxonomy,'term'=>$term->slug);
  43. $query = new WP_Query ($wpq);
  44. $article_count = $query->post_count;
  45.  
  46.  
  47.  
  48.  
  49.  
  50. if ($article_count) {
  51. $posts = $query->posts;
  52. foreach ($posts as $post) {
  53. include(MY_THEME_FOLDER . '/insertsloop.php');
  54. }
  55. }
  56. echo ' </table>';
  57. }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement