Support » Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies » wp-types – showing custom field on parent

  • Resolved pawciak

    (@pawciak)


    Hi!

    I am wondering why this piece of code:

    <?php $cena_produktu = types_render_field("cena", array("raw"=>"true"));  echo $cena_produktu; ?>

    is not working on a page as parent? well.. it’s working on a single page perfectly, but when I wanted to show multiple pages on one (showing childs on parent) i receive blank value instead of custom field. This is my loop:

    <?php
                $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
                $count = 0;
                foreach($pages as $page)
                {
                $content = $page->post_content;
                ?>
                <table class="menu-content-item">
                    <tr>
                        <td colspan="2" class="menu-item-featured"><?php echo get_the_post_thumbnail( $page->ID, 'thumbnail' ); ?></td>
                    </tr>
                    <tr>
                        <td colspan="2" class="menu-item-headline"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></td>
                    </tr>
                    <tr>
                        <td class="menu-item-desc">
                        <?php echo $content ?>
                        <div class="news-item-readmore"><a href="<?php echo get_page_link($page->ID) ?>" title="<?php echo get_page_link($page->ID) ?>" class="btn btn-default readmore">Czytaj więcej..</a></div>
                        </td>
                        <td class="menu-item-price">
                            <dl>
                                <dt class="price-label">CENA:</dt>
                                <dt class="price-value"><?php $cena_produktu = types_render_field("cena", array("raw"=>"true"));  echo $cena_produktu; ?>
    
                                </dt>
                                <dt class="price-currency">PLN</dt>
                            </dl>
                        </td>
                    </tr>
                </table>
                        <?php
            }
            ?>

    what I am doing wrong?

    https://wordpress.org/plugins/types/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp-types – showing custom field on parent’ is closed to new replies.