Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jurek2006

    (@jurek2006)

    @josh – with an “=” comparison it’s the same – OR works fine, AND doesn’t work.

    Sorry for caps. In my code I don’t use caps – in this testing code I had names in polish so I translated them to english pasting into forum. And I used caps only for forum.

    This part of code looks like this:
    'where' => '(dzienn.name = "sroda")AND(dzienn.name = "poniedzialek")'

    Do you use AND for the same relationship field?
    It works perfect for two different fields, like this:
    'where' => '(dzienn.name ="sroda")AND(lang.name = "pl")'

    When you do normal loop (without where), is it possible to get to this data in category.name or category.slug, can you print them?

    Is the category custom pods taxonomy?

    I’ve tried. For me it works perfect, even if one book is novel and also comics(at least with pods 2.5)
    I haven’t used ‘category’ because WP doesn’t let me to name pods taxonomy like this, nor ‘type’ (it printed pods name) so I named custom pods taxonomy ‘kind’:

    <h1>NOVEL</h1>
    				<?php
    				//------------------------ NOVEL
    
    				$params = array('limit' => -1,
    								'where'   => 'kind.name LIKE "%Novel%"');
    				$pods = pods('book', $params);
                    if ( $pods->total() > 0 ) {
                        while ( $pods->fetch() ) {
                            //Put field values into variables
                            $name = $pods->display('name');
    						$type = $pods->display('kind');
    				?>
                    	<h2><?php echo $name; ?></h2>
                        <p><?php  echo $type ?></p>
                    <?php
    					}//while ( $pods->fetch() )
    				}
    				else
    					echo 'Error';//( $pods->total() > 0 )
    				?>
    				<h2>COMICS</h2>
    				<?php
    				$params = array('limit' => -1,
    				'where'   => 'kind.name LIKE "%Comics%"');
    				$pods = pods('book', $params);
                    if ( $pods->total() > 0 ) {
                        while ( $pods->fetch() ) {
                            //Put field values into variables
                            $name = $pods->display('name');
    						$type = $pods->display('kind');
    				?>
                    	<h2><?php echo $name; ?></h2>
                        <p><?php  echo $type ?></p>
                    <?php
    					}//while ( $pods->fetch() )
    				}
    				else
    					echo 'Error';//( $pods->total() > 0 )
    				 ?>

    I got output like this:

    NOVEL
    aaa
    novel
    
    ccc
    novel
    
    ddd
    comics and novel
    
    COMICS
    bbb
    comics
    
    ddd
    comics and novel

    Have you tried with ‘where’ in params?
    If you have pods Books and e.g. taxonomy Type with two items: Novel, Comics you can do something like this:

    //loop for Novel
    $params = array( 'limit' => -1,
    	          'where'   => 'type.name LIKE "%Novel%"' );
    $pods = pods( 'books', $params );
    ...

    I’m not sure about ‘name’ in type.name, maybe it should be type.title. I don’t remember how it’s called in Pods.

    I have the same problem. Since 2.5.1 field doesn’t return an array.

    For tests I’ve got custom taxonomy (author) and custom post type (book) [with author as Built-in Taxonomy]

    And e.g. I’ve got a book „Impossible” with multiple authors Tolkien and King in pods 2.5 I have theme code like this:

    (...)
    $params = array('limit' => -1);
    $pods = pods('ksiazka', $params);
    if ( $pods->total() > 0 ) {
    	while ( $pods->fetch() ) {
                            $title = $pods->display('name');
    		$author = $pods->field('author.slug');
    ?>
    
    		<h1><?php echo $title; ?></h1>
     		<p>author:
    		<?php for($i=0; $i<count($author); $i++){
    			echo $author[$i].', ';
    		}
    ?>
                        </p>
    (...)

    And it works perfect with multiple authors. In 2.5.1 it doesn’t work (Nor in 2.5.1.1)
    In 2.5.1 and 2.5.1.1 a paragraph instead of:
    author: tolkien, king,

    looks like:
    author: k,
    (only the first letter from first author)
    when I try only echo $author it prints ok, but only the first author. I can’t figure it out how to get to all multiple author items.

    I’ve tried this with several different pods custom post types and custom taxonomies, even reinstalling pods or with completly new WP installation. Always the same. Now I have all three versions of pods in the same installation and switching between them – always perfect with 2.5 and doesn’t work with newer.

Viewing 4 replies - 1 through 4 (of 4 total)