Posted By

redconservatory on 07/21/11


Tagged

wordpress cms pods


Versions (?)

Pods CMS for Wordpress: retrieve and display pod entries


 / Published in: PHP
 

URL: http://mondaybynoon.com/2010/01/04/pulling-pods-data/

A great plugin for Wordpress: http://podscms.org

Currently does not play well with plugins that use custom fields but this will change in version 2.

For more information, refer to: http://mondaybynoon.com/2010/01/04/introduction-to-pods-cms-wordpress/

  1. <?php
  2. /*
  3.  
  4. Pod name = 'name_of_your_pod'
  5. Pod columns
  6. id (not shown in the admin, but it's there)
  7. name (default, required)
  8. entry (created, paragraph)
  9.  
  10. */
  11.  
  12. $type_of_pod = new Pod('name_of_your_pod');
  13. $type_of_pod->findRecords('name ASC'); // sorts by the name of the pod
  14. $total = $type_of_pod->getTotalRows(); // gets all the pod with that 'type'
  15.  
  16.  
  17. if( $total>0 ) :
  18.  
  19. while ( $type_of_pod->fetchRecord() ) :
  20.  
  21. $id = $type_of_pod -> get_field('id');
  22. $name = $type_of_pod ->get_field('name');
  23. $entry = $type_of_pod ->get_field('entry');
  24.  
  25. ?><p><?php echo $id ?></p>
  26. <p><?php echo $name ?></p>
  27. <p><?php echo $entry ?></p><?php
  28.  
  29. endwhile;
  30.  
  31. endif;
  32. ?>

Report this snippet  

You need to login to post a comment.