Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | None | 0 0
  1. <?php
  2. //query CPT by related CPT's title
  3. $params = array(
  4.     'limit' => -1,
  5.     'where' => 'book_author.post_title = "J.R.R. Tolkien" '
  6.                
  7.               );
  8. $pods = pods( 'book', $params );
  9. if ( $pods->total() > 0 ) {
  10.     while ( $pods->fetch() ) {
  11.         echo $pods->display( 'post_title' );
  12.         echo '<br>';
  13.     }
  14. }
  15.  
  16.  
  17. <?php
  18. /**
  19.  * The template for displaying all single posts
  20.  *
  21.  * @package WordPress
  22.  * @subpackage Twenty_Thirteen
  23.  * @since Twenty Thirteen 1.0
  24.  */
  25.  
  26. get_header(); ?>
  27.  
  28.     <div id="primary" class="content-area">
  29.         <div id="content" class="site-content" role="main">
  30.  
  31.             <?php /* The loop */ ?>
  32.             <?php while ( have_posts() ) : the_post();
  33.  
  34.  
  35.              get_template_part( 'content', get_post_format() );
  36.             echo get_post_meta( get_the_ID(), 'sub_title' );
  37.  
  38.                 ?>
  39.                 <?php twentythirteen_post_nav(); ?>
  40.                 <?php comments_template(); ?>
  41.  
  42.             <?php endwhile; ?>
  43.  
  44.         </div><!-- #content -->
  45.     </div><!-- #primary -->
  46.  
  47. <?php get_sidebar(); ?>
  48. <?php get_footer(); ?>
  49.  
  50.  
  51.  
  52. <?php
  53. /**
  54.  * The main template file
  55.  *
  56.  * This is the most generic template file in a WordPress theme and one of the
  57.  * two required files for a theme (the other being style.css).
  58.  * It is used to display a page when nothing more specific matches a query.
  59.  * For example, it puts together the home page when no home.php file exists.
  60.  *
  61.  * @link http://codex.wordpress.org/Template_Hierarchy
  62.  *
  63.  * @package WordPress
  64.  * @subpackage Twenty_Thirteen
  65.  * @since Twenty Thirteen 1.0
  66.  */
  67.  
  68. get_header(); ?>
  69.  
  70.     <div id="primary" class="content-area">
  71.         <div id="content" class="site-content" role="main">
  72.         <?php
  73.         $params = array( 'limit' => 2 );
  74.  
  75.         $pods = pods( 'book', $params);
  76.  
  77.  
  78.         if ( $pods->total() > 0 ) {
  79.             while( $pods->fetch( ) ) {
  80.                 echo '<a href="'.get_permalink( $pods->id() ).'">'.$pods->display( 'post_title' ).'</a>';
  81.                 echo '<br>';
  82.             }
  83.             echo $pods->pagination();
  84.         }
  85.         else {
  86.             echo 'nope';
  87.         }
  88. ?>
  89.  
  90.         </div><!-- #content -->
  91.     </div><!-- #primary -->
  92.  
  93. <?php get_sidebar(); ?>
  94. <?php get_footer(); ?>
  95.  
  96.  
  97. <?php
  98. print_r2( get_term( 2, 'genre' ) );
  99. $params = array(
  100.     'limit' => -1,
  101.     'where' => 'genre.term_id = "2" '
  102.                
  103.               );
  104. $pods = pods( 'book', 300 );
  105.  
  106. echo $pods->form( array( 'fields' => array( 'post_title', 'subtitle' ), 'fields_only' => true ) );
  107.  
  108.  
  109. var_dump( pods_v( 'bar', $params, false, true ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement