Advertisement
Guest User

Custom Field by Post Category

a guest
Sep 14th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1.         //...other codes...
  2.  
  3.     <?php
  4.         //variabel for defined custom field
  5.         $custom_field_fitur = nl2br(get_post_meta($post->ID,"Fitur",true));
  6.         $custom_field_organiser = get_post_meta($post->ID,"Organiser",true);
  7.       ?>
  8.                   </div> //end div...
  9. <?php
  10. //create variabel to defined category name...
  11. $cats = wp_get_post_categories('Handphone');
  12.  
  13. //if category Handphone
  14. if ($cats) : ?>
  15.                         <div class="fiture">
  16.                             <h3>Fitur</h3>
  17.                             <?php
  18.                     echo $custom_field_fitur;
  19.                 ?>
  20.                         </div>
  21.                         <div class="organiser">
  22.                             <h3>Organizer</h3>
  23.                             <?php
  24.                     echo $custom_field_organiser;
  25.                 ?>
  26.                         </div>
  27.  
  28. //else..
  29. <?php else : ?>
  30.  
  31. <div class="fiture">
  32.                             <h3>Spesifikasi</h3>
  33.                             <?php
  34.                     echo $custom_field_organiser;
  35.                             ?>
  36.                         </div>
  37.  
  38. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement