WordPress.org

Support

Support » Plugins and Hacks » Pods - Custom Content Types and Fields » [Resolved] Template conditional stopped working on last update

[Resolved] Template conditional stopped working on last update

  • I have a template that shows a book CPT (how generic is that?!). We generate a list of buy links based on ISBNs, both print and digital. We have two sections that have conditional statements to list blocks based on if the field has a non 0 value (since they are Plain Number fields, and default to 0), for both ISBNs.

    Here is the first one:

    <?php if ($obj->field('isbn_print') != '0') { ?>
        ISBN: {@isbn_print}<br />
    <?php } ?>
    <?php if ($obj->field('isbn_digital') != '0') { ?>
        ebook ISBN: {@isbn_digital}<br />
    <?php } ?>

    That works fine. Then we have another section to list some links to various URLs:

    <?php if ($obj->field('isbn_print') != '0') { ?>
     <p>Order this book in print:</p>
     <ul>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=az">Amazon</a></li>
     <li><a href="http://search.barnesandnoble.com/books/product.aspx?r=1&EAN={@isbn_print}">Barnes and Noble</a></li>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=bamm">Books-A-Million</a></li>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=buycom">Rakuten.com Shopping</a></li>
     <li><a href="http://www.indiebound.org/product?isbn={@isbn_print}">IndieBound</a></li>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=ch">Indigo (Canada)</a></li>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=pw">Powell's Books</a></li>
     <li><a href="http://www.perseusbookspromos.com/processors/retail.php?isbn13={@isbn_print}&r=wal">Walmart</a></li>
     </ul>
    <?php } ?>
    
    <?php if ($obj->field('isbn_digital') != '0') { ?>
     <p>Order this book in digital format:</p>
     <ul>
     <li><a href="http://www.amazon.com/s/field-keywords={@isbn_digital}">Amazon (Kindle)</a></li>
     <li><a href="http://itunes.apple.com/us/book/isbn{@isbn_digital}">Apple iTunes</a></li>
     <li><a href="http://www.kobobooks.com/search/search.html?q={@isbn_digital}">Kobo</a></li>
     <li><a href="http://search.barnesandnoble.com/books/product.aspx?r=1&EAN={@isbn_digital}">Barnes & Noble (Nook)</a></li>
     </ul>
    <?php } ?>

    Those were working, but someone noticed that books without digital ISBNs were showing links. Then I verified by deleting the print ISBN that those links are still showing, too, which they shouldn’t.

    Poking around the forums I found issue #1991, but from that thread I don’t know how those conditional tags work, or if they are only part of the Frontier plugin.

    Any ideas on what that suddenly stopped working, or a better way to template that? ^_^

    https://wordpress.org/plugins/pods/

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Template conditional stopped working on last update’ is closed to new replies.
Skip to toolbar