• Resolved adnan21

    (@adnan21)


    hi guys,
    i’am really new to wp and of course also to pods. i just created a cpt called layout, added a filed called header and then aaded a new layout layout1.
    i also created my first theme with a simple index.php:

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <meta charset="<?php bloginfo('charset'); ?>">
            <?php wp_head(); ?>
        </head>
        <body>
            <pre>
            <?php
            $layouts = pods('layout');
            echo $layouts->total()>0?"Y":"N";
            while ($layouts->fetch()) {
                print_r($layouts->display('header'));
            }
            ?>
            </pre>
        </body>
    </html>

    but there is no fetch-result, total is zero!
    what did i miss?
    thx in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter adnan21

    (@adnan21)

    ok, i added $layouts->find(['limit' => -1]); after $layouts = pods('layout'); and now i can fetch the results. now i have to figure out, how to get the content of the custom field.

    Thread Starter adnan21

    (@adnan21)

    oookaay… that simple echo $layouts->field('header');

    Plugin Contributor Jim True

    (@jimtrue)

    Looks like you figured it out. Good work 😉

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

The topic ‘->total() = 0’ is closed to new replies.