WordPress.org

Support

Support » Plugins and Hacks » [Resolved] error on code

[Resolved] error on code

  • hi i have used this code in search.php template it works perfectly but when i put this code in 404.php template a warning is shown .

    Invalid argument supplied for foreach()

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    										<?php
    // call your taxonomy as a pod because when you extend it, it makes it a pod object
    $store = pods( 'store' );
    // Get terms for post using typical wordpress terms loop
    $terms = get_the_terms( $post->ID , 'store' );
    // Loop over each item since it's an array
    foreach ( $terms as $term ) {
    //do a typical fetch to get your pod fields
    $store->fetch( $term->term_id );
    $store_logo = $store->get_field('store_logo');
    $store_currency = $store->get_field('store_currency');
    $store_permalink = $store->get_field('permalink');
    }
    ?>

    please help me out.
    thanks.

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

Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] error on code’ is closed to new replies.